Re: Issue with CURL detecting network outage
Date: Thu, 17 Dec 2009 11:46:29 +0530
On Wed, Dec 16, 2009 at 9:25 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Wed, 16 Dec 2009, Jogeshwar Karthik Akundi wrote:
> Client uses CURL to connect to server using Connect_Only option.
>> While the connection is running, if network cable is removed, the
>> is not being detected.
>> I use select() to verify readibility/writability on the socket and use
>> curl_easy_read/write to receive/send data.
>> when using the socket descriptor in read/write sets, select doesn't return
>> FD_ISSET. it only times out.
> so I tried to skip select and force sending data to CURL if buffers are
>> available. Then curl_easy_send returns success. It is able to send packets
>> of 20 bytes (verified only a few packets though) without errors, while I
>> hold the network cable in my hand.
> That sounds odd, but maybe you should consider having your heartbeat system
> require a response within a certain time anyway?
Actually this is a one way communication with server we use. Server does
send requests but I cannot impose any such rules. If the client doesn't send
data for a minute, server disconnects the client, so client send dummy
packets to keep the connection alive. That is the heartbeat I was referring
to. I hoped that at least this send would fail and we can have the
disconnected notification in hand.
> In the same case, we get an error immediately on windows. This issue is
>> OSX specific (atleast for me here).
> Perhaps it is, but I'm not aware of any such OSX peculiarities. What does
> (the equivalent of) strace show?
Please find the strace logs attached.
Being on OSX, I used dtruss to get the output. The entire output is taken
while the plug is pulled out.
you can search for "byets" in the file and you shall find a couple of lines.
they are logged after the curl_easy_send returns success.
> / daniel.haxx.se
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
- text/plain attachment: strace_output.txt