Re: Threads, sockets and windows



On Mon, Aug 07, 2006 at 09:44:06PM +0300, Vladimir wrote:
> Hello,
> 
> I'm trying to write two-threaded program: one thread for GUI and the other
> for network. The network thread needs to poll network socket and to receive
> messages from the GUI thread (such as commands to send something to network
> or to disconnect). I've used pipe for commands, so in the network thread I
> can simply poll() network socket and pipe together.
> 
> But on windows there is no poll() function. Of course I can use
> g_async_queue, but doing so I can't poll queue and network socket
> simultaneously.
> 
> Are there any method to poll g_async_queue and network socket or pipe and
> network socket on windows simultaneously ? Or may be, is there something in
> the GTK/Glib for this kind of situations ?

look into GNet:

http://www.gnetlibrary.org/

It uses g_io_ stuff, so it's easy to do asynch io with it, and gnet
makes setting up sockets pretty simple.  I haven't used it on windows,
but it has been ported.  I imaging it should work.  Added plus: you
don't need threads.

- Anna




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]