Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jython: rpyc Server doesn't report correct listening port when set to 0 #156

Closed
campbellr opened this issue Jan 30, 2015 · 1 comment
Closed

Comments

@campbellr
Copy link

This seems to just be a quirk in Jython's socket implementation (see jython issue 1806):

>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
>>> s.bind(("localhost", 0))
>>> s.settimeout(0.5)
>>> s.getsockname()
('127.0.0.1', 0)

But, if we add a call to s.listen, the next s.getsockname() returns the correct info:

>>> s.listen(1)
>>> s.getsockname()
('127.0.0.1', 57581)

I'm not sure how much you care about Jython suport, but it seems like it would pretty safe to update self.port in Server.start after calling listen.

@coldfix coldfix closed this as completed in a8214fd Jul 3, 2017
@coldfix
Copy link
Contributor

coldfix commented Jul 3, 2017

Thanks! Fix implemented as understood from your description (better late than never). Give me a shout if the problem is not solved.

Best, Thomas

coldfix added a commit that referenced this issue Jul 26, 2017
- Add missing endpoints config in ThreadPoolServer (#222)
- Fix jython support (#156,#171)
- Improve documentation (#158,#185,#189,#198 and more)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants