Code Review Request: 7096436: (sc) SocketChannel.connect fails on Windows 8 when channel configured non-blocking

Kurchi Hazra kurchi.subhra.hazra at oracle.com
Fri May 4 11:46:43 PDT 2012


Hi,

  We were seting localAddress when establishing the connection but for 
the non-blocking case, it is possible that the socket is not yet bound.
We therefore change this behavior and retrieve the localAddress in 
SocketChannelImpl.getLocalAddress() when the socket is bound and 
localAddress is null or isAnyLocalAddress.

However, I also had to introduce an additional boolean field to keep 
track of when the socket is bound. This is to circumvent the  problem 
that we
don't get an error (similar to WSAEINVAL on windows) on 
solaris/linux/mac when calling getsockopt on an unbound socket. 
Consequently, localAddress
and localPort are being set to 0.0.0.0 and 0 on these platforms, instead 
of the required null and -1.

Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7096436
Webrev: http://cr.openjdk.java.net/~khazra/7096436/webrev.00/

Thanks,
Kurchi


More information about the nio-dev mailing list