socket()and the subsequent
close()of the same file descriptor.
CURLOPT_OPENSOCKETFUNCTIONcallback, you can provide a custom function to return a file descriptor for libcurl to use:
opensocket_callbackfunction must match this prototype:
CURLSOCKTYPE_ACCEPT, identifying in which circumstance the socket is created. The "accept" case being when libcurl is used to accept an incoming FTP connection for when FTP active mode is used, and all other cases when libcurl creates a socket for its own outgoing connections the IPCXN value is passed in.
struct curl_sockaddrthat describes the IP address of the network destination for which this socket is created. Your callback can for example use this information to whitelist or blacklist specific addresses or address ranges.
CURL_SOCKET_BAD, which then will cause an unrecoverable error within libcurl and it will eventually return
CURLE_COULDNT_CONNECTfrom its perform function.
curl_sockaddressstruct looks like this:
closesocket_callbackfunction must match this prototype: