Hi!

On Wed, Jan 21, 2009 at 06:16:47PM -0500, arthur wrote:
>When I connect to a remote unreachable tcp port, connect() return -1
>(with errno as EINPROGRESS). If I use event_add, I can get read event
>later and then getsockopt(fd, SOL_SOCKET, SO_ERROR,..) will tell me
>error.

Just a note: For tracking a non-blocking connect, you use a *write*
event, not a *read* event. Using the getsockopt you specify is right
then. For successful connects, the read event would not trigger once the
connection is established, but only after something is *received* (e.g.
a server greeting) or when the connection is closed again (e.g. server
timeout). In contrast, the write event will trigger both on successful
connect, as well as on connection failure.

>If I create bufferevent_new with the connect fd directly, I got
>no event any all.

>Can I get connect() error with bufferevent?

Can't answer that, alas. Haven't used bufferevents yet. Could you use
vanilla events to track wait for the connection to be established
(unless you get a zero return from connect() already) and only *then*
start using bufferevents?

Kind regards,

Hannah.
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to