At Sun, 27 Nov 2005 22:53:40 +0100,
Alexander Lazic wrote:
> 
> Hi,
> 
> this is my first post on these list and my first use of the great
> libevent ;-)).
> 
> I have looked at the archive but haven't found a helpfull answer :-(
> 
> I wan't to make a nonblocking connect with libevent but i'am not sure if
> i must make a
> 
> event_set(...);
> event_add(...);
> 
> or not
> 
> I have at the moment a 'simple' echo server but now i want to connect
> to another server and write the input to the server.
> 
> If anybody wan't to see the echo server for help and clearness the code
> ist at: http://none.at/main.c
> It is a little bit easy, therefore i don't have add some checks, please
> ignore these mistakes,thanx ;-)
> 
> Does anybody have a 'simple' and easy to understand example for me ;-)
> 
> Thanx for help and greetings
>
If connect returns -1 with errno not set to EINPROGRESS something went
wrong. Otherwise use event_set+event_add to wait for EV_WRITE. The event
will trigger when the connection has succeded (or failed). I don't know
if there's a good way to know if the connection failed other than to just
go ahead and write and then handle errors.

Good luck!
--
Richard Nyberg <[EMAIL PROTECTED]>
BTPD - BitTorrent in a daemon - http://www.murmeldjur.se/btpd/

_______________________________________________
Libevent-users mailing list
[email protected]
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to