juhovh / shairplay

Apple airplay and raop protocol server
Other
1.35k stars 228 forks source link

Set SO_REUSEADDR on server sockets #29

Closed kfigiela closed 9 years ago

kfigiela commented 10 years ago

This patch prevents "Error initialising socket 98" error when restarting shairplay.

Memphiz commented 9 years ago

Did you check if this is available on windows too? Or does this break compilation for other platforms which are non-posix? ^^

kfigiela commented 9 years ago

No, I didn't, but https://msdn.microsoft.com/en-us/library/windows/desktop/ms740621(v=vs.85).aspx says that this is supported on Windows.

juhovh commented 9 years ago

The SO_REUSEADDR works differently on each platform and I've wondered about the security implications of it... However looks like someone has written a very thorough explanation in http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t and it also looks like one can already steal the socket on Windows. So maybe we don't have to care about that and could just apply SO_REUSEADDR...