Re: Using Glib::IOChannel for socket connections



On Tue, 3 Feb 2009, Chris Vine <chris cvine freeserve co uk> wrote :
You can set the file descriptor returned by
socket() non-blocking and poll it in the same way as you can poll the
one returned by accept() (certainly you can do that with select() so I
imagine you can do it with Glib::SignalIO which uses poll() under the
hood). The callback will execute when there is a new connection pending
and you can call accept() on the file descriptor and establish the
client connection. This is the way you do it in single-threaded
programs.

I've done that in the past, and it does work. ISTR there was some oddity but it was small and easily solved. Might depend whether you need to be able to accept multiple connections. Possibly something to do with making a new IOChannel for the accept()'d connection.
--
Rob Pearce                       http://www.bdt-home.demon.co.uk

The contents of this | Windows NT crashed.
message are purely   | I am the Blue Screen of Death.
my opinion. Don't    | No one hears your screams.
believe a word.      |


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