Boost logo

Boost :

Subject: Re: [boost] [asio] Read timeout and failures
From: Mark Van Dijk (Mark.VanDijk_at_[hidden])
Date: 2011-03-16 22:47:05


> However, I have a question regarding failures. I have been using a synchronous
> read_some() call. This states that it will return/throw an error/exception on an
> error condition. If I'm connected on a TCP socket to another device and I
> UNPLUG the network cable, does this not shutdown the socket and shouldn't the
> read_some() return/throw an error/exception. Unplugging the cable seems like
> an error condition to me, but in my case, the code just hangs at the read_some()
> call and never returns.

In the general case, TCP will only find out that the connection is down when it next SENDS a packet and doesn't get an ACK back. I believe that if you unplug the local network cable from a computer, then the hardware/OS should detect this and signal a failure to the TCP recv() call (at least it does on my machine), however if the connection is broken further down the line, then the computer has no idea that anything is wrong.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk