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

race problem when starting server with port 0 #362

Closed
PerBothner opened this issue Jan 6, 2016 · 3 comments
Closed

race problem when starting server with port 0 #362

PerBothner opened this issue Jan 6, 2016 · 3 comments
Labels
Milestone

Comments

@PerBothner
Copy link

I'm starting the server with a port of 0, so I can then immediately open a client of the server, without hard-wiring in a specific port. Before I start the client, I need to call getPort(). But that may not work, since the server field may not have been set yet, and that happens in a separate thread. My suggestion is to move the initial socket.bind to the start method, before the run method in the new thread. See included patch.

startserver-patch.txt

@marci4
Copy link
Collaborator

marci4 commented Mar 30, 2017

Hello @PerBothner
could you please open a pull request for your commit?

Thx

Greetings
marci4

@PerBothner
Copy link
Author

I no longer use Java-WebSocket (for Domterm I use libwebsockets instead).
However, I created a quick pull request #449 .
I tested that it still compiles, but I haven't otherwise tested it.

Glad to see Java-WebSocket is seeing some love again, even though I no longer use it myself.

@marci4
Copy link
Collaborator

marci4 commented Mar 30, 2017

Hello @PerBothner

thx for your pull request.
Gonna test it soon :)

Closing the issue.
Greetings
marci4

@marci4 marci4 closed this as completed Mar 30, 2017
@marci4 marci4 added this to the Release 1.3.3 milestone Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants