Hi all,
I tried to use the libevent library (on FreeBSD 7.0) to detect when the
socket becomes writeable. Actually, i want to detect if destination host
is reachable and has started tcp listener on desired port:
# if ( connect(fd, ...) < 0 )
# perror("connect error");
# event_set(&ev_connect, client_s, EV_WRITE, fn, ...);
# event_add(&ev_connect, NULL);
where the function fn is:
# void fn (...) {
# cout << "Function fn!" << endl;
# }
When i tried to connect to reachable host (but without tcp listener on
desired port), the situation is following:
connect error: Connection refused
Function fn! (*program enters immediately into function fn*)
On the other hand, when i try to connect to unreachable host i get the
following:
connect error: Operation now in progress
Function fn! (*after a few seconds*)
So, I have two questions.
How to use libevent (in case of reachable host) to detect that the other
host really has started tcp listener on desired port?
And the second one.. What is the timeout period after which program
enters the function fn?
Tnx in advance,
--
Ana Kukec, B.Sc,
ZTEL <http://www.tel.fer.hr>, FER <http://www.fer.hr>,
http://ana.kukec.net
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users