Date: Fri, 11 May 2001 16:17:32 -0400 (EDT)
From: Peter Jones - JavaSoft East <###@###.###>
...
Also, looking at the code for SocketChannelImpl.translateAndSetReadyMask,
it ssems like it maps POLLIN to OP_CONNECT, but it's my understanding
that the OS actually uses POLLOUT to indicate that an outgoing connection
has been successfully made. For example, from the poll(2) man page:
A file descriptor for a socket that is listening for connec-
tions will indicate that it is ready for reading, once con-
nections are available. A file descriptor for a socket that
is connecting asynchronously will indicate that it is ready
for writing, once a connection has been established.
I see that there is a regression test "BasicConnect.java", and I was
wondering if it only seems to "pass" just because it connects to the
time server port, which always responds with data on a new connection
with no further prompting-- so the POLLIN that OP_CONNECT gets mapped
to will trigger anyway. I tried modifying BasicConnect to connect to
an HTTP server (jini.east:80), which, of course, doesn't send any data
upon connection, and then the test hung (until the web server's read
timeout eventually expired), although netstat showed that a connection
had indeed been established. Modifying the bit translation logic in
SocketChannelImpl in my workspace to map OP_CONNECT to POLLOUT made the
test "pass" again.
From: Peter Jones - JavaSoft East <###@###.###>
...
Also, looking at the code for SocketChannelImpl.translateAndSetReadyMask,
it ssems like it maps POLLIN to OP_CONNECT, but it's my understanding
that the OS actually uses POLLOUT to indicate that an outgoing connection
has been successfully made. For example, from the poll(2) man page:
A file descriptor for a socket that is listening for connec-
tions will indicate that it is ready for reading, once con-
nections are available. A file descriptor for a socket that
is connecting asynchronously will indicate that it is ready
for writing, once a connection has been established.
I see that there is a regression test "BasicConnect.java", and I was
wondering if it only seems to "pass" just because it connects to the
time server port, which always responds with data on a new connection
with no further prompting-- so the POLLIN that OP_CONNECT gets mapped
to will trigger anyway. I tried modifying BasicConnect to connect to
an HTTP server (jini.east:80), which, of course, doesn't send any data
upon connection, and then the test hung (until the web server's read
timeout eventually expired), although netstat showed that a connection
had indeed been established. Modifying the bit translation logic in
SocketChannelImpl in my workspace to map OP_CONNECT to POLLOUT made the
test "pass" again.