[ENet-discuss] Using enet in X11 event loop

Lee Salzman lsalzman1 at cox.net
Tue Sep 4 07:11:49 PDT 2007


Calling the service routine from a timer is about the best you can do.

It's not quite right to think of enet as providing a socket. It's really
a tiny little user-space networking stack. There are unpredictable 
events it needs to deal with at regular intervals, so you
mostly have to service it regularly.

Lee

Darrin Smart wrote:
> Hi,
> 
> Has anyone managed to integrate enet into a X11 (Xt) event loop? We
> are currently calling enet_service() from a timer but I would like to
> be able to use the XtAppAddInput() function to create callbacks when
> the enet socket is ready for reading or writing.
> 
> The reading side is straightforward - when there is data available on
> the socket I get a callback and I can run enet_service().
> 
> But on the sending side its not so straightforward. I really only want
> the Xt callback to be active only when enet has data queued for
> sending. That leaves quite a few places where I need to activate the
> Xt callback.
> 
> Is there a better way? Maybe the enet API could include hooks so the
> user can specify the enable/disable function for output, which the
> library could call from the right internal functions.
> 
> Thanks.
> 
> Darrin



More information about the ENet-discuss mailing list