-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Comments
Hello @PerBothner Thx Greetings |
I no longer use Java-WebSocket (for Domterm I use libwebsockets instead). Glad to see Java-WebSocket is seeing some love again, even though I no longer use it myself. |
Hello @PerBothner thx for your pull request. Closing the issue. |
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
The text was updated successfully, but these errors were encountered: