1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerTitle: curl_multi_socket 5*6236dae4SAndroid Build Coastguard WorkerSection: 3 6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl 7*6236dae4SAndroid Build Coastguard WorkerSee-also: 8*6236dae4SAndroid Build Coastguard Worker - curl_multi_cleanup (3) 9*6236dae4SAndroid Build Coastguard Worker - curl_multi_fdset (3) 10*6236dae4SAndroid Build Coastguard Worker - curl_multi_info_read (3) 11*6236dae4SAndroid Build Coastguard Worker - curl_multi_init (3) 12*6236dae4SAndroid Build Coastguard Worker - the hiperfifo.c example 13*6236dae4SAndroid Build Coastguard WorkerProtocol: 14*6236dae4SAndroid Build Coastguard Worker - All 15*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.15.4 16*6236dae4SAndroid Build Coastguard Worker--- 17*6236dae4SAndroid Build Coastguard Worker 18*6236dae4SAndroid Build Coastguard Worker# NAME 19*6236dae4SAndroid Build Coastguard Worker 20*6236dae4SAndroid Build Coastguard Workercurl_multi_socket - read/write available data 21*6236dae4SAndroid Build Coastguard Worker 22*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS 23*6236dae4SAndroid Build Coastguard Worker 24*6236dae4SAndroid Build Coastguard Worker~~~c 25*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h> 26*6236dae4SAndroid Build Coastguard WorkerCURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t sockfd, 27*6236dae4SAndroid Build Coastguard Worker int *running_handles); 28*6236dae4SAndroid Build Coastguard Worker~~~ 29*6236dae4SAndroid Build Coastguard Worker 30*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION 31*6236dae4SAndroid Build Coastguard Worker 32*6236dae4SAndroid Build Coastguard WorkerThis function is deprecated. Do not use. See curl_multi_socket_action(3) 33*6236dae4SAndroid Build Coastguard Workerinstead. 34*6236dae4SAndroid Build Coastguard Worker 35*6236dae4SAndroid Build Coastguard WorkerAt return, the integer **running_handles** points to contains the number of 36*6236dae4SAndroid Build Coastguard Workerstill running easy handles within the multi handle. When this number reaches 37*6236dae4SAndroid Build Coastguard Workerzero, all transfers are complete/done. Note that when you call 38*6236dae4SAndroid Build Coastguard Workercurl_multi_socket(3) on a specific socket and the counter decreases by one, it 39*6236dae4SAndroid Build Coastguard WorkerDOES NOT necessarily mean that this exact socket/transfer is the one that 40*6236dae4SAndroid Build Coastguard Workercompleted. Use curl_multi_info_read(3) to figure out which easy handle that 41*6236dae4SAndroid Build Coastguard Workercompleted. 42*6236dae4SAndroid Build Coastguard Worker 43*6236dae4SAndroid Build Coastguard WorkerThe curl_multi_socket(3) functions inform the application about updates in the 44*6236dae4SAndroid Build Coastguard Workersocket (file descriptor) status by doing none, one, or multiple calls to the 45*6236dae4SAndroid Build Coastguard Workersocket callback function set with the CURLMOPT_SOCKETFUNCTION(3) option to 46*6236dae4SAndroid Build Coastguard Workercurl_multi_setopt(3). They update the status with changes since the previous 47*6236dae4SAndroid Build Coastguard Workertime the callback was called. 48*6236dae4SAndroid Build Coastguard Worker 49*6236dae4SAndroid Build Coastguard WorkerGet the timeout time by setting the CURLMOPT_TIMERFUNCTION(3) option with 50*6236dae4SAndroid Build Coastguard Workercurl_multi_setopt(3). Your application then gets called with information on 51*6236dae4SAndroid Build Coastguard Workerhow long to wait for socket actions at most before doing the timeout action: 52*6236dae4SAndroid Build Coastguard Workercall the curl_multi_socket_action(3) function with the **sockfd** argument set 53*6236dae4SAndroid Build Coastguard Workerto CURL_SOCKET_TIMEOUT. You can also use the curl_multi_timeout(3) function to 54*6236dae4SAndroid Build Coastguard Workerpoll the value at any given time, but for an event-based system using the 55*6236dae4SAndroid Build Coastguard Workercallback is far better than relying on polling the timeout value. 56*6236dae4SAndroid Build Coastguard Worker 57*6236dae4SAndroid Build Coastguard WorkerUsage of curl_multi_socket(3) is deprecated, whereas the function is 58*6236dae4SAndroid Build Coastguard Workerequivalent to curl_multi_socket_action(3) with **ev_bitmask** set to 0. 59*6236dae4SAndroid Build Coastguard Worker 60*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS% 61*6236dae4SAndroid Build Coastguard Worker 62*6236dae4SAndroid Build Coastguard Worker# EXAMPLE 63*6236dae4SAndroid Build Coastguard Worker 64*6236dae4SAndroid Build Coastguard Worker~~~c 65*6236dae4SAndroid Build Coastguard Workerint main(void) 66*6236dae4SAndroid Build Coastguard Worker{ 67*6236dae4SAndroid Build Coastguard Worker /* the event-library gets told when there activity on the socket 'fd', 68*6236dae4SAndroid Build Coastguard Worker which we translate to a call to curl_multi_socket_action() */ 69*6236dae4SAndroid Build Coastguard Worker int running; 70*6236dae4SAndroid Build Coastguard Worker int rc; 71*6236dae4SAndroid Build Coastguard Worker int fd; 72*6236dae4SAndroid Build Coastguard Worker CURLM *multi; 73*6236dae4SAndroid Build Coastguard Worker rc = curl_multi_socket(multi, fd, &running); 74*6236dae4SAndroid Build Coastguard Worker} 75*6236dae4SAndroid Build Coastguard Worker~~~ 76*6236dae4SAndroid Build Coastguard Worker 77*6236dae4SAndroid Build Coastguard Worker# DEPRECATED 78*6236dae4SAndroid Build Coastguard Worker 79*6236dae4SAndroid Build Coastguard Workercurl_multi_socket(3) is deprecated, use curl_multi_socket_action(3) instead. 80*6236dae4SAndroid Build Coastguard Worker 81*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY% 82*6236dae4SAndroid Build Coastguard Worker 83*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE 84*6236dae4SAndroid Build Coastguard Worker 85*6236dae4SAndroid Build Coastguard WorkerCURLMcode type, general libcurl multi interface error code. 86*6236dae4SAndroid Build Coastguard Worker 87*6236dae4SAndroid Build Coastguard WorkerThe return code is for the whole multi stack. Problems still might have 88*6236dae4SAndroid Build Coastguard Workeroccurred on individual transfers even when one of these functions return OK. 89