Hi all,
I developed a library which let you connect to N sources, writes a request and reads the responce, using apr_poll.
I have 2 questions about 2 problems I'm trying to solve.
The first is a design question: in my method I open N sockets, set the option APR_SO_NONBLOCK and timeout X (otherwise connect fails), connect them, write the request, create a pollset with the flag APR_POLLIN for each entry and then I call apr_pollset_poll.
In your opinion is it ok, or I should set the flag APR_POLLIN | APR_POLLOUT for each entry and then write or read when apr_pollset_poll retuns?
The second question is about apr_pollset_poll timeout.
I set the option APR_SO_NONBLOCK (I want no blocking IO): in this way apr_pollset_poll returns when only a part of the output from socket Y is ready. So I'm inside a while and I call apr_pollset_poll untill all the output of all sockets is ready or timeut expires.
Is the timeout of apr_pollset_poll global, or each time I call apr_pollset_poll it starts again?
If it starts each time, how can I make it global with APR_SO_NONBLOCK socket?
Thanks
Regards
--Marco