Re: Best libev way to write in a socket

2011-06-21 Thread Brandon Black
On Tue, Jun 21, 2011 at 1:31 PM, Zabrane wrote: > Hi Brandon, > Could your proxy code be shared for new comers (as me)? > It'll be very good if build up a repository of libev examples. Unfortunately it's not very good example code in its current state. It uses unportable things (e.g. Linux's spli

Re: Best libev way to write in a socket

2011-06-21 Thread Zabrane
Hi Brandon, Could your proxy code be shared for new comers (as me)? It'll be very good if build up a repository of libev examples. Regards Zab Le 20 juin 11 à 17:59, Brandon Black a écrit : 2011/6/20 Jaime Fernández : b) What's the most convenient way to write data in a TCP socket: 1.-

Re: Best libev way to write in a socket

2011-06-21 Thread Jaime Fernández
Thanks Brandon, You've provided a great information. In fact, I was trying to create a very simple proxy which routes according to some criteria. Your hints will be very helpful. ___ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bi

Re: Best libev way to write in a socket

2011-06-20 Thread Brandon Black
2011/6/20 Jaime Fernández : > b) What's the most convenient way to write data in a TCP socket: >     1.- "send" data directly in the read callback >     2.- Create a write watcher >     3.- Create a watcher of both types: READ&WRITE. It really depends on the nature of the protocol and the data tra

Re: Best libev way to write in a socket

2011-06-20 Thread Pierre-Yves Kerembellec
> Well, I've just found out why the "Invalid file descriptor" was generated. I > didn't stop the "read watcher" when creating the "write watcher". > > So, I just maintain my second question: > What's the most convenient way to write data in a TCP socket: > 1.- "send" data directly in the read

Re: Best libev way to write in a socket

2011-06-20 Thread Jaime Fernández
Well, I've just found out why the "Invalid file descriptor" was generated. I didn't stop the "read watcher" when creating the "write watcher". So, I just maintain my second question: What's the most convenient way to write data in a TCP socket: 1.- "send" data directly in the read callback

Best libev way to write in a socket

2011-06-20 Thread Jaime Fernández
I'm starting with libev and I've followed this example: http://codefundas.blogspot.com/2010/09/create-tcp-echo-server-using-libev.html which creates an echo server. However, I don't think it's not the most efficient approach because the writing could get blocked, isn't it? So, what I've done is: a