Set SO_REUSEADDR on TCP servers, as in MRI. Fixes #378.

This commit is contained in:
Charles Oliver Nutter 2015-08-06 14:00:07 -05:00
parent 657dafdcff
commit 4d7548c275
1 changed files with 2 additions and 0 deletions

View File

@ -101,6 +101,8 @@ public class RubyTCPServer extends RubyTCPSocket {
InetAddress addr = InetAddress.getByName(host);
ServerSocketChannel ssc = ServerSocketChannel.open();
ssc.socket().setReuseAddress(true);
InetSocketAddress socket_address = new InetSocketAddress(addr, port);
ssc.socket().bind(socket_address);