cURL / Mailing Lists / curl-library / Single Mail


How to cleanly close the curl socket in case of multi interface?

From: nikhil ap <>
Date: Fri, 19 Sep 2014 16:52:48 +0530

I have setup the connection context similar to the one given the
example hiperfifo.c which is a structure contains a pointer to the easy
handle, url, socket info and other application stuff and stats.

I have created 10 TCP connections by adding 10 easy handles to multi
After a connection is done with some requests lets about 100, I would like
to close the connection and TCP socket by sending a FIN.

When the connection needs to be cleaned up, I do calls to


but this does not close the TCP connection and eventually the connection
gets a FIN from server side after keepalive timeout or if clients sends a
FIN after the test when I do curl_multi_cleanup().

I do like to keep the connection persistent in some cases and close in some

As a work around, when I have to cleanup the connection, I do close on curl
socket which triggers a FIN.

Is there a better way to close the socket?

List admin:
Received on 2014-09-19