curl-library
Re: Curllib on vista?
Date: Wed, 5 Mar 2008 23:38:44 +0000
Jared Wilkin wrote:
> So I guess the issue is
> what is the preferred way to detect a closed connection on Vista? The
> method that works on XP (where select returns with the read FD set and
> then an attempt to read returns 0 bytes read) doesn't work on Vista, Is
> there another way to test the socket, perhaps done in the case where
> select times out, to see if it is closed?
In general, there is no way to detect that a TCP/IP connection has
gone away, except by waiting for a timeout.
With XP, it detected that the cable was removed: that's a special case.
But even XP won't detect other ways the network might go away, such as
a cable or router failure elsewhere in the network, or the cable being
removed from the server you're connecting to.
Also, sometimes shutting down a socket because the cable was removed
is wrong. That's probably why they changed it in Vista.
(GNU/Linux has both options, of course :-)
TCP/IP and the internet do not provide "virtual circuits"; it is not
like a telephone call, and you don't always get told when the
connection is lost.
-- Jamie
Received on 2008-03-06