Re: Sockets with GTK 2.8.9 on WIN32



On 2/10/06, Gabriele Greco <gabriele greco darts it> wrote:
I've a problem on an application on WIN32 with GTK 2.8.x that works
flawlessly with GTK 2.6.x (always on win32) or GTK 2.8.x (on unix).

It seems that with 2.8.9 (the installer version got from gimp-win home)
the sockets are handled as non blocking also if you don't specify this.

It's a wanted behaviour?

Specifically I often receive "0" if I call recv() in my gdk_input_add(
GDK_INPUT_READ ) call, this happens on GTK 2.6 and early only when the
connection is closed by the remote peer.

With GTK 2.8, and only on WIN32, I often receive 0 from recv and an
error code of WSAEWOULDBLOCK.

This is a problem since my code often rely on the fact socket calls are
blocking...

That is one of the changes that were made in Glib 2.8.x.  All of the
win32 GIOChannel stuff was changed such that it'll leave your sockets
in non-blocking mode.  See this bug report for more information: 
http://bugzilla.gnome.org/show_bug.cgi?id=147392

Basically, if you want your socket to be non-blocking, you have to
make it so in the input function every time it is triggered.

I thought that I had seen this in the documentation somewhere, but
apparently not.

-D



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