Re: Problems with GIOChannels and sockets



On Fri, 17 Dec 2004 01:53:54 +0100 (CET), Arne Skjaerholt
<arnsholt online no> wrote:
Hello all,
I am starting to do some gtk application development, and I've started on a network server application. 
Obviously I'm using the BSD socket interface to the network, and after a bit of digging I found the 
GIOChannel interface for doing IO with gtk.
Now my problem is that my GIOChannel never seems to go be in any other state than G_IO_IN, which 
susequently makes it a bit tricky to know when the remote host closes the connection. I've noticed that 
reading from the closed socket always returns an empty string, so I guess that might be a workaround to the 
problem, but it really seems to me that there is should be a better way to do this.

No, that's not a workaround. When your callback is called and the read
operations gets 0 bytes it means that the conneciton on the other end
is closed.

-Gonzalo



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