I wrote a small TCP servers with socket()
+ POLLIN poll()
+ recv()
+ send()
, but I don\'t know when to use <
Working on a Raspberry PI 3, Debian, using c++ 98 with gcc . . .
In an implementation of the Acceptor / Connector pattern and Reactor / Proactor / ACT pattern I regulary use POLLOUT in the following sequence:
In most cases connect returns a -1. Because of the non blocking file descriptor this is very likely. Then I check the result code.
If it is EINPROGRESS, I register an event handler in the reactor (which uses ppoll or epoll) with POLLOUT. When the connection is finally done, poll returns with POLLOUT set.
Then I create a new TcpConnection class and communicate.