Return to curl_multi_assign.3 CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / curl / docs / libcurl |
1.1 ! misho 1: .\" ************************************************************************** ! 2: .\" * _ _ ____ _ ! 3: .\" * Project ___| | | | _ \| | ! 4: .\" * / __| | | | |_) | | ! 5: .\" * | (__| |_| | _ <| |___ ! 6: .\" * \___|\___/|_| \_\_____| ! 7: .\" * ! 8: .\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. ! 9: .\" * ! 10: .\" * This software is licensed as described in the file COPYING, which ! 11: .\" * you should have received as part of this distribution. The terms ! 12: .\" * are also available at https://curl.haxx.se/docs/copyright.html. ! 13: .\" * ! 14: .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell ! 15: .\" * copies of the Software, and permit persons to whom the Software is ! 16: .\" * furnished to do so, under the terms of the COPYING file. ! 17: .\" * ! 18: .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY ! 19: .\" * KIND, either express or implied. ! 20: .\" * ! 21: .\" ************************************************************************** ! 22: .TH curl_multi_assign 3 "March 23, 2020" "libcurl 7.70.0" "libcurl Manual" ! 23: ! 24: .SH NAME ! 25: curl_multi_assign \- set data to associate with an internal socket ! 26: .SH SYNOPSIS ! 27: #include <curl/curl.h> ! 28: ! 29: CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, ! 30: void *sockptr); ! 31: .SH DESCRIPTION ! 32: This function creates an association in the multi handle between the given ! 33: socket and a private pointer of the application. This is designed for ! 34: \fIcurl_multi_socket_action(3)\fP uses. ! 35: ! 36: When set, the \fIsockptr\fP pointer will be passed to all future socket ! 37: callbacks for the specific \fIsockfd\fP socket. ! 38: ! 39: If the given \fIsockfd\fP isn't already in use by libcurl, this function will ! 40: return an error. ! 41: ! 42: libcurl only keeps one single pointer associated with a socket, so calling ! 43: this function several times for the same socket will make the last set pointer ! 44: get used. ! 45: ! 46: The idea here being that this association (socket to private pointer) is ! 47: something that just about every application that uses this API will need and ! 48: then libcurl can just as well do it since it already has an internal hash ! 49: table lookup for this. ! 50: .SH "RETURN VALUE" ! 51: The standard CURLMcode for multi interface error codes. ! 52: .SH "TYPICAL USAGE" ! 53: In a typical application you allocate a struct or at least use some kind of ! 54: semi-dynamic data for each socket that we must wait for action on when using ! 55: the \fIcurl_multi_socket_action(3)\fP approach. ! 56: ! 57: When our socket-callback gets called by libcurl and we get to know about yet ! 58: another socket to wait for, we can use \fIcurl_multi_assign(3)\fP to point out ! 59: the particular data so that when we get updates about this same socket again, ! 60: we don't have to find the struct associated with this socket by ourselves. ! 61: .SH AVAILABILITY ! 62: This function was added in libcurl 7.15.5. ! 63: .SH "SEE ALSO" ! 64: .BR curl_multi_setopt "(3), " curl_multi_socket_action "(3) "