TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.53k stars 2.58k forks source link

Update WebSocketServer.java #1288

Closed NRicode closed 1 year ago

NRicode commented 1 year ago

allow server to be restarted instantly when application is restarted

PhilipRoman commented 1 year ago

setReuseAddr is a public method anyway, is there a specific reason you want it turned on by default instead of being opt-in? I did have a look at major web servers and they all seem to use SO_REUSEADDR so maybe it's not such a bad idea.

NRicode commented 1 year ago

setReuseAddr is a public method anyway, is there a specific reason you want it turned on by default instead of being opt-in? I did have a look at major web servers and they all seem to use SO_REUSEADDR so maybe it's not such a bad idea.

wait, is it really public? iirc it wasn't. Even though if it was public, I still think the default value should be true. Not everyone is familiar with low level socket and it wasted so much of my time trying to debug this because the server simply won't start when I restart my application and I believe other people struggled with this aswell especially people who aren't familiar with low level socket.