curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Timeout with curl multi on connection refused on windows

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 16 Feb 2017 14:24:10 +0100 (CET)

On Thu, 16 Feb 2017, Philippe Daouadi wrote:

>> The state machine will stay in that state until a connect is verified or
>> failed, so yes. But for a failed connect, the socket should get a signal
>> too and the regular "monitoring" of the socket should get triggered,
>> libcurl should get called again and the failed connection attempt get
>> noticed.

> That's the problem, I don't know how this "monitoring" works during
> connection. From what I understand of the multi API, curl will call my
> opensocket callback, and I must return a new socket, but not connect it,
> then curl will do the connect() by itself. So I don't think I can signal
> curl that the connection is complete or not, and I don't know how curl can
> get that event either.

The socket monitoring works the same way to the application, independent of
libcurl's internal state. You setup a socket callback with
CURLMOPT_SOCKETFUNCTION and libcurl calls that function and tells you which
sockets to wait for and for what activities you should monitor on them. Then
you call libcurl when such an activity has been detected.

That should work also for detecting a failed connection.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-02-16