At Sat, 22 Apr 2006 01:24:24 -0700, [EMAIL PROTECTED] wrote:
> Hello, all ...
> 
> I'm using libEvent to write a streaming media server, mainly to test  
> epoll() on Linux / kqueue on Mac OSX / etc. for scalability.  Right  
> now, my test server waits for n connections to be established (n  
> specified on the command line), calling event_add() for each  
> connection, then calls event_dispatch() and sends bytes to each  
> client.  The sockets are non-blocking, but right now, event_dispatch 
> () blocks until all clients have received all of the bytes (i'm  
> streaming a 40MB MPEG file for now as a test).  I would like to have  
> the number of connections be more variable, so I want to continue  
> accepting new connections from other clients, while i'm handling  
> events for the ones I have.  However, since event_dispatch() is  
> blocking, my accept() isn't happening.
> 
> I could solve this by adding another thread (assuming libEvent is  
> thread-safe), but i'd rather not do that.  Can I make event_dispatch 
> () not block, or is there some other way to do what I want to do?
> 

Make the socket you accept on non blocking and register a read callback for
it. Accept new connections in the callback.

Regards,
        -Richard
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to