Atom Feed SITE FEED   ADD TO GOOGLE READER

Bind a single time to the same port in Mac OS X

I think I've resolved a problem I came across earlier: I could bind to the same port multiple times using NIO on Mac OS X.

A kind soul named Timothy Wall has helped me to work-around the problem. Just call setSoReuseAddress(false) on the channel's socket before binding:
        ServerSocketChannel channel = ServerSocketChannel.open();

ServerSocket socket = channel.socket();
socket.setReuseAddress(false);
socket.bind(listenAddress);


See the related thread on the Mac Java mailing list:
http://lists.apple.com/archives/java-dev/2004/Dec/msg00570.html