[zeromq-dev] zclock_sleep in "connect" in Freelance client API
Matias GUIJARRO
matias.guijarro at esrf.fr
Tue Feb 7 11:18:50 CET 2012
Hi all,
In the FLP example from The Guide, there is a "zclock_sleep(100)" in
function
flcliapi_connect, in order to allow connection to come up.
My question is :
Is it really the Good Way of making sure connection came up ?
I am afraid of relying on "sleep".
Instead of a doing a sleep like this, I am trying to determine when
connection is
ready by waiting on a POLLOUT event on the socket FD obtained with
getsockopt.
Is it a good idea ?
It doesn't seem to be reliable, though (at least with my code). Sometimes it
waits enough, sometimes not.
If someone has an example of how to properly wait for connection to be
established, I would very happy to see how it is achieved.
If sleeping is not the best solution, maybe the example code in
Freelance client API
should be modified with the proper solution, then.
Thanks in advance,
Matias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120207/49892e83/attachment.htm>
More information about the zeromq-dev
mailing list