Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
curl_multi_assign(3) | Library Functions Manual | curl_multi_assign(3) |
NAME
curl_multi_assign - set data to associate with an internal socketSYNOPSIS
#include <curl/curl.h>
CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd,
void *sockptr);
DESCRIPTION
This function creates an association in the multi handle between the given socket and a private pointer of the application. This is designed for curl_multi_socket_action(3) uses.PROTOCOLS
This functionality affects all supported protocolsEXAMPLE
int main(void)
{
CURLM *multi = curl_multi_init();
void *ourstructp; /* pointer to our data */
curl_socket_t fd; /* file descriptor to associate our data with */
/* make our struct pointer associated with socket fd */
CURLMcode mc = curl_multi_assign(multi, fd, ourstructp);
if(mc)
printf("error: %s\n", curl_multi_strerror(mc));
}
TYPICAL USAGE
In a typical application you allocate a struct or at least use some kind of semi-dynamic data for each socket that we must wait for action on when using the curl_multi_socket_action(3) approach.AVAILABILITY
Added in curl 7.15.5RETURN VALUE
The standard CURLMcode for multi interface error codes.SEE ALSO
curl_multi_setopt(3), curl_multi_socket_action(3)2024-12-21 | libcurl |