java - ServerSocket reuseAddress allow bind to an already bound port? -
when using netty, surprised if use reuseaddress option, allows serversocket bind same address without raising "already bind exception"
serverbootstrap bootstrap = new serverbootstrap( new nioserversocketchannelfactory(executors .newcachedthreadpool(), executors.newcachedthreadpool())); bootstrap.setpipelinefactory(new channelpipelinefactory() { @override public channelpipeline getpipeline() throws exception { channelpipeline p = pipeline(); p.addlast("handler", new dummyhandler()); return p; } }); bootstrap.setoption("reuseaddress", true); bootstrap.bind(new inetsocketaddress(2000)); bootstrap.bind(new inetsocketaddress(2000));
i thought reuseaddress allows new socket reuse close-wait socket, different. following result of netstat command
c:\users\secmask>netstat -a -n|grep 2000 tcp 0.0.0.0:2000 0.0.0.0:0 listening tcp 0.0.0.0:2000 0.0.0.0:0 listening
am missing something? what's going on?
i assume windows allows due history. bit of security issue. see http://msdn.microsoft.com/en-us/library/ms740618 information how involved options interact. socket gets connection undefined. maybe if narrow down version of windows using narrow down response although not depend on it.
Comments
Post a Comment