GIO channels and "connection closed by foreign host" on WIN32
- From: Gabriele Greco <gabriele greco darts it>
- To: gtk-app-devel-list gnome org
- Subject: GIO channels and "connection closed by foreign host" on WIN32
- Date: Tue, 17 Mar 2009 16:07:53 +0100
I have a problem with the WIN32 port of a project.
I use a GIO channel to wrap the socket, I handle the socket as async
(so in case of error I check for EWOULDBLOCK/EINPROGRESS...), the
program works ok and the callback is called when there is data on the
socket.
The problem I have is that on linux if the connecton is closed from
the "foreign host" (ctrl + c in a shell with "nc -lp 4000" in my basic
tests) the callback is called and recv() returns a 0, so I can detect
the socket is closed.
On WIN32 closing the remote host connection has no effect at all, no
callback is called. I detect the situation only if I send()
something....
I thought it was a different behaviour of win32 / linux socket
implementation, so I've built a small program that uses select()
instead of GTK+ to wait for the sockets, and I get a consistent
behaviour both in win32 and linux (select trigger -> FD_ISSET sock ->
recv sock -> returns 0).
I checked the GIO channel documentation but except for the well known
fact that polling a GSource on Win32 put the socket in async mode I
found nothing else...
--
Bye,
Gabry
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]