cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl multi interface - handling abnormal disconnections

From: Jonathan Masters <jon_at_than.cc>
Date: Sat, 25 Jan 2014 12:38:02 +0000

I am using the multi interface and I can't seem to work out the following,

1. If I start a connection and it never connects, how do I know this? It is
not like I can get its fd from the curl multi fdset as it's not there.

2. If I start a connection, with tcp keepalive on, the connection is
successful, then for some reason the connection is broken so there are no
replies to the tcp keepalives, how do I know the connection is dead before
the next request attempt?

I did try to use the opensocket/closesocket callbacks, storing the fd's,
and manually calling send(fd,0,0,0) on each fd later on and checking the
return code which did seem to work for point [2]. The next problem was I
made the opensocket callback block which then meant curl_multi_perform
would block, which is no good if I have many connections trying to connect.
I can make it non blocking but I don't know how to let curl know the socket
isn't connected yet. I then tried to run curl multi perform in another
thread (which doesn't really solve anything to be honest) but this caused
various crashes, I'm guessing due to me removing curl handles from another
thread.

Anyway I can't believe it this complicated just to know when a connection
doesn't succeed or if one times out due to keepalives not being responded
to, I'm missing something I guess?

Thanks for any help,

Jon

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-25