Re: asynchronous socket writing

2010-03-12 Thread Marc Lehmann
On Thu, Mar 11, 2010 at 10:22:48PM +0100, jo...@lophus.org jo...@lophus.org wrote: Accept, read, process, write -- all the stuff you do when you get an HTTP request. well, *during* accept, read, process etc. obviously you cannot accept other requests (for that, it would have to be

Re: asynchronous socket writing

2010-03-12 Thread Jonas H.
On 03/12/2010 03:50 PM, Marc Lehmann wrote: No, it uses events and non-blocking I/O, was other people have pointed out. I am very sorry but I still don't get it. How on earth can I get the 'you-can-now-write' event for another client/request/whatever while writing to another client the

Re: asynchronous socket writing

2010-03-12 Thread Dan White
On 12/03/10 16:49 +0100, Jonas H. wrote: On 03/12/2010 03:50 PM, Marc Lehmann wrote: No, it uses events and non-blocking I/O, was other people have pointed out. I am very sorry but I still don't get it. How on earth can I get the 'you-can-now-write' event for another

Re: asynchronous socket writing

2010-03-12 Thread Graham Leggett
On 12 Mar 2010, at 5:49 PM, Jonas H. wrote: How on earth can I get the 'you-can-now-write' event for another client/request/whatever while writing to another client the same time? You don't, thus the importance of everything you do being non blocking. Is this something libev handles for

Re: asynchronous socket writing

2010-03-11 Thread Maarten Foqué
If this is your first go with C and sockets, I suggest you leave the multi-threaded thing be for a while. To use libev and socket you first want to understand how it works or you may end up rewriting your application. For libev I suggest looking at the documentation and starting with a simple

Re: asynchronous socket writing

2010-03-11 Thread Graham Leggett
On 10 Mar 2010, at 8:15 PM, Jonas H. wrote: I'm currently taking my first steps in socket/C programming and I want to implement a fast, multi-threaded web server for testing purpose. I decided to have a single accept/listen/whatever thread for now. However, I want asynchronous read at

Re: asynchronous socket writing

2010-03-11 Thread Marc Lehmann
On Wed, Mar 10, 2010 at 07:15:16PM +0100, Jonas H. jo...@lophus.org wrote: I'm currently taking my first steps in socket/C programming and I want to implement a fast, multi-threaded web server for testing purpose. I If I were you, I'd avoid threads, especially as my first steps. decided

Re: asynchronous socket writing

2010-03-11 Thread Brian Maher
On Thu, Mar 11, 2010 at 4:53 AM, Marc Lehmann schm...@schmorp.de wrote: They are non-blocking when the underlying fd is non-blocking, they are never asynchronous. What is the difference between non-blocking and asynchronous? I thought these words where synonyms, and wikipedia seems to think so

Re: asynchronous socket writing

2010-03-11 Thread Graham Leggett
On 11 Mar 2010, at 4:54 PM, Jonas H. wrote: Thanks for that lot of answers! I think you're right with avoiding thread for now. Actually I don't really need/want threads, I just didn't know there's another way to go (nonblocking I/O). What I don't really get is: If libev is event-driven,

Re: asynchronous socket writing

2010-03-11 Thread Marc Lehmann
On Thu, Mar 11, 2010 at 06:02:15AM -0800, Brian Maher mah...@brimworks.com wrote: They are non-blocking when the underlying fd is non-blocking, they are never asynchronous. What is the difference between non-blocking and asynchronous? Non-blocking simply means that the OS will not wait

Re: asynchronous socket writing

2010-03-11 Thread Marc Lehmann
On Thu, Mar 11, 2010 at 03:54:05PM +0100, Jonas H. jo...@lophus.org wrote: What I don't really get is: If libev is event-driven, why won't I get other 'accepts' while there's already another transaction going on in the background? (I've set both sockets to be nonblocking.) Does this

Re: asynchronous socket writing

2010-03-11 Thread jo...@lophus.org
Whats a transaction? Accept, read, process, write -- all the stuff you do when you get an HTTP request. ___ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev