Imported Upstream version 7.44.0
[platform/upstream/curl.git] / docs / libcurl / curl_multi_socket_action.html
index 319754b..5d01486 100644 (file)
@@ -4,15 +4,20 @@
 <title>curl_multi_socket_action man page</title>
 <meta name="generator" content="roffit">
 <STYLE type="text/css">
-P.level0 {
+pre {
+  overflow: auto;
+  margin: 0;
+}
+
+P.level0, pre.level0 {
  padding-left: 2em;
 }
 
-P.level1 {
+P.level1, pre.level1 {
  padding-left: 4em;
 }
 
-P.level2 {
+P.level2, pre.level2 {
  padding-left: 6em;
 }
 
@@ -47,12 +52,13 @@ p.roffit {
 
 <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
 <p class="level0">curl_multi_socket_action - reads/writes available data given an action <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
-<p class="level0"><pre>
-<p class="level0">#include &lt;curl/curl.h&gt;
- <p class="level0">CURLMcode curl_multi_socket_action(CURLM * multi_handle,
- &nbsp;                                  curl_socket_t sockfd, int ev_bitmask,
- &nbsp;                                  int *running_handles);
- </pre>
+<p class="level0"><pre class="level0">
+&#35;include &lt;curl/curl.h&gt;
+&nbsp;
+CURLMcode curl_multi_socket_action(CURLM * multi_handle,
+&nbsp;                                  curl_socket_t sockfd, int ev_bitmask,
+&nbsp;                                  int *running_handles);
+</pre>
 
 <p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
 <p class="level0">When the application has detected action on a socket handled by libcurl, it should call <a Class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action</a> with the <span Class="bold">sockfd</span> argument set to the socket with the action. When the events on a socket are known, they can be passed as an events bitmask <span Class="bold">ev_bitmask</span> by first setting <span Class="bold">ev_bitmask</span> to 0, and then adding using bitwise OR (|) any combination of events to be chosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or CURL_CSELECT_ERR. When the events on a socket are unknown, pass 0 instead, and libcurl will test the descriptor internally. It is also permissible to pass CURL_SOCKET_TIMEOUT to the <span Class="bold">sockfd</span> parameter in order to initiate the whole process or when a timeout occurs. 
@@ -60,16 +66,18 @@ p.roffit {
 <p class="level0">The <a Class="bold" href="./curl_multi_socket_action.html">curl_multi_socket_action</a> functions inform the application about updates in the socket (file descriptor) status by doing none, one, or multiple calls to the socket callback function set with the CURLMOPT_SOCKETFUNCTION option to <a Class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt</a>. They update the status with changes since the previous time the callback was called. 
 <p class="level0">Get the timeout time by setting the <span Class="emphasis">CURLMOPT_TIMERFUNCTION</span> option with <a Class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt</a>. Your application will then get called with information on how long to wait for socket actions at most before doing the timeout action: call the <a Class="bold" href="./curl_multi_socket_action.html">curl_multi_socket_action</a> function with the <span Class="bold">sockfd</span> argument set to CURL_SOCKET_TIMEOUT. You can also use the <a Class="emphasis" href="./curl_multi_timeout.html">curl_multi_timeout</a> function to poll the value at any given time, but for an event-based system using the callback is far better than relying on polling the timeout value. <a name="CALLBACK"></a><h2 class="nroffsh">CALLBACK DETAILS</h2>
 <p class="level0">
-<p class="level0">The socket <span Class="bold">callback</span> function uses a prototype like this <pre>
-<p class="level0"><p class="level0">&nbsp; int curl_socket_callback(CURL *easy,      /* easy handle */
- &nbsp;                          curl_socket_t s, /* socket */
- &nbsp;                          int action,      /* see values below */
- &nbsp;                          void *userp,    /* private callback pointer */
- &nbsp;                          void *socketp); /* private socket pointer,
- &nbsp;                                             <span Class="bold">NULL</span> if not
- &nbsp;                                             previously assigned with
- &nbsp;                                             <a Class="bold" href="./curl_multi_assign.html">curl_multi_assign</a> */
- <p class="level0"></pre>
+<p class="level0">The socket <span Class="bold">callback</span> function uses a prototype like this <pre class="level0">
+&nbsp;
+&nbsp; int curl_socket_callback(CURL *easy,      /* easy handle */
+&nbsp;                          curl_socket_t s, /* socket */
+&nbsp;                          int action,      /* see values below */
+&nbsp;                          void *userp,    /* private callback pointer */
+&nbsp;                          void *socketp); /* private socket pointer,
+&nbsp;                                             <span Class="bold">NULL</span> if not
+&nbsp;                                             previously assigned with
+&nbsp;                                             <a Class="bold" href="./curl_multi_assign.html">curl_multi_assign</a> */
+&nbsp;
+</pre>
 
 <p class="level0">The callback MUST return 0. 
 <p class="level0">The <span Class="emphasis">easy</span> argument is a pointer to the easy handle that deals with this particular socket. Note that a single handle may work with several sockets simultaneously.