Hello!
I have done some experimentation.
First I used telnet to verify that the host xx.xx.xx.xx on port 80 is
up and listening. We verify that this is true.
Then, we run a test program.
The test program creates a TCP socket which will connect to a given host
on a given port then use the fcntl() call to set the non-blocking bit.
We then use connect() to connect to the host. We verify that the errno
is indeed EINPROGRESS.
We then use poll with an events member set to POLLIN | POLLOUT.
This is the result on a return from poll().
glee@orion ~/tmp $ ./poll-new -h xx.xx.xx.xx -p 80
connect
connect: INPROGRESS
poll: POLLOUT is set
terminating
glee@orion ~/tmp $
So, POLLOUT is set.
Now, we try to connect to an invalid port.
n ~/tmp $ ./poll-new -h xx.xx.xx.xx -p 4
connect
connect: INPROGRESS
poll: POLLERR set
poll: POLLHUP set
poll: POLLOUT is set
terminating
glee@orion ~/tmp $
So, POLLOUT is set.
By the way, what constants should be defined when you do a #include <poll.h>?
A lot of them are not defined, those listed in the poll() document on
the opengroup website, only POLLPRI and POLLIN, POLLOUT, POLLNVAL,
POLLHUP and POLLERR are defined.
POLLRDNORM, POLLRDBAND, POLLWRBAND, POLLWRNORM are not defined.
-- G.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/