diff options
Diffstat (limited to 'erts/doc/src')
-rw-r--r-- | erts/doc/src/socket.xml | 37 | ||||
-rw-r--r-- | erts/doc/src/socket_usage.xml | 29 |
2 files changed, 39 insertions, 27 deletions
diff --git a/erts/doc/src/socket.xml b/erts/doc/src/socket.xml index 47e84090ee..e5cf77663a 100644 --- a/erts/doc/src/socket.xml +++ b/erts/doc/src/socket.xml @@ -324,7 +324,7 @@ <p>In the case when there is no connections waiting, the function will return with the <c>SelectInfo</c>. The caller can then await a - select message, <c>{'$socket', Sock, select, Info}</c> (where + select message, <c>{'$socket', Socket, select, Info}</c> (where <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>), when a client connects (a subsequent call to accept will then return the socket). </p> @@ -377,7 +377,7 @@ <func> <name name="connect" arity="2" since="OTP 22.0"/> - <name name="connect" arity="3" since="OTP 22.0"/> + <name name="connect" arity="3" clause_i="2" since="OTP 22.0"/> <fsummary>Initiate a connection on a socket.</fsummary> <desc> <p>This function connects the socket to the address @@ -386,6 +386,24 @@ </func> <func> + <name name="connect" arity="3" clause_i="1" anchor="connect_async" since="OTP @OTP-15731@"/> + <fsummary>Initiate a connection on a socket.</fsummary> + <desc> + <p>This function connects the socket to the address + specied by the <c>SockAddr</c> argument.</p> + + <p>In the case when its not possible to immediately establish a + connection, the function will return with the + <seealso marker="#type-select_info"><c>SelectInfo</c></seealso>. + The caller can then await a + select message, <c>{'$socket', Socket, select, Info}</c> (where + <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>, + a subsequent call to connect will then + establish the connection). </p> + </desc> + </func> + + <func> <name name="getopt" arity="3" clause_i="1" since="OTP 22.0"/> <name name="getopt" arity="3" clause_i="2" since="OTP 22.0"/> <name name="getopt" arity="3" clause_i="3" since="OTP 22.0"/> @@ -505,7 +523,7 @@ <p>In the case when there is no data waiting, the function will return with the <c>SelectInfo</c>. The caller can then await a - select message, <c>{'$socket', Sock, select, Info}</c> (where + select message, <c>{'$socket', Socket, select, Info}</c> (where <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>), when data has arrived (a subsequent call to recv will then return the data). </p> @@ -564,7 +582,7 @@ <p>In the case when there is no data waiting, the function will return with the <c>SelectInfo</c>. The caller can then await a - select message, <c>{'$socket', Sock, select, Info}</c> (where + select message, <c>{'$socket', Socket, select, Info}</c> (where <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>), when data has arrived (a subsequent call to recvfrom will then return the data). </p> @@ -640,7 +658,7 @@ <p>In the case when there is no data waiting, the function will return with the <c>SelectInfo</c>. The caller can then await a - select message, <c>{'$socket', Sock, select, Info}</c> (where + select message, <c>{'$socket', Socket, select, Info}</c> (where <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>), when data has arrived (a subsequent call to recvmsg will then return the data). </p> @@ -667,7 +685,8 @@ <p>In the case when there is no room in the (system-) buffers, the function will return with the <c>SelectInfo</c>. The caller - can then await a select message, <c>{'$socket', Sock, select, Info}</c> + can then await a select message, + <c>{'$socket', Socket, select, Info}</c> (where <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>), when there is room for more data (a subsequent call to send will then send the data). </p> @@ -724,7 +743,8 @@ <p>In the case when there is no room in the (system-) buffers, the function will return with the <c>SelectInfo</c>. The caller - can then await a select message, <c>{'$socket', Sock, select, Info}</c> + can then await a select message, + <c>{'$socket', Socket, select, Info}</c> (where <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>), when there is room for more data (a subsequent call to sendmsg will then send the data). </p> @@ -751,7 +771,8 @@ <p>In the case when there is no room in the (system-) buffers, the function will return with the <c>SelectInfo</c>. The caller - can then await a select message, <c>{'$socket', Sock, select, Info}</c> + can then await a select message, + <c>{'$socket', Socket, select, Info}</c> (where <c>Info</c> is the <c>select_ref()</c> from the <c>SelectInfo</c>), when there is room for more data (a subsequent call to sendto will then send the data). </p> diff --git a/erts/doc/src/socket_usage.xml b/erts/doc/src/socket_usage.xml index 9d8141b822..7e65bcbf70 100644 --- a/erts/doc/src/socket_usage.xml +++ b/erts/doc/src/socket_usage.xml @@ -43,6 +43,7 @@ <title>Asynchronous calls</title> <p>Some functions allow for an <i>asynchronous</i> call (<seealso marker="socket#accept_async"><c>accept/2</c></seealso>, + <seealso marker="socket#connect_async"><c>connect/3</c></seealso>, <seealso marker="socket#recv_async"><c>recv/3,4</c></seealso>, <seealso marker="socket#recvfrom_async"><c>recvfrom/3,4</c></seealso>, <seealso marker="socket#recvmsg_async"><c>recvmsg/2,3,5</c></seealso>, @@ -52,21 +53,17 @@ This is achieved by setting the <c>Timeout</c> argument to <c>nowait</c>. For instance, if calling the <seealso marker="socket#recv_async"><c>recv/3</c></seealso> - function with Timeout set to <c>nowait</c> (i.e. <c>recv(Sock, 0, nowait)</c>) + function with Timeout set to <c>nowait</c> (i.e. + <c>recv(Sock, 0, nowait)</c>) when there is actually nothing to read, it will return with <c>{ok, </c> <seealso marker="socket#type-select_info"><c>SelectInfo</c></seealso><c>}</c>. When data eventually arrives a 'select message' will be sent to the caller:</p> - <!-- - <list type="ordered"> - <item><c>{'$socket', Sock, select, Info}</c></item> - </list> - --> <taglist> <!-- NOTE THAT THE EMPTY TAG IS INTENTIONAL --> <tag></tag> - <item><c>{'$socket', Sock, select, Info}</c></item> + <item><c>{'$socket', socket(), select, select_ref()}</c></item> </taglist> <p>The caller can then make another call to the recv function and now expect data.</p> @@ -79,24 +76,18 @@ <taglist> <!-- NOTE THAT THE EMPTY TAG IS INTENTIONAL --> <tag></tag> - <item><c>{'$socket', Sock, abort, Info}</c></item> + <item><c>{'$socket', socket(), abort, Info}</c></item> </taglist> <p>If the operation is aborted for whatever reason (e.g. if the socket is closed "by someone else"). The <c>Info</c> part contains the abort reason (in this case that - the socket has been closed <c>Info = {Ref, closed}</c>). </p> + the socket has been closed <c>Info = {select_ref(), closed}</c>). </p> <p>Note that all other users are <em>locked out</em> until the 'current user' has called the function (recv in this case). So either immediately call the function or <seealso marker="socket#cancel/2"><c>cancel</c></seealso>. </p> + <p>The general form of the 'socket' message is: </p> - <!-- - <list type="ordered"> - <item> - <c>{'$socket', Socket :: socket(), Tag :: atom(), Info :: term()}</c> - </item> - </list> - --> <taglist> <!-- NOTE THAT THE EMPTY TAG IS INTENTIONAL --> <tag></tag> @@ -110,15 +101,15 @@ </row> <row> <cell>select</cell> - <cell>reference()</cell> + <cell>select_ref()</cell> </row> <row> <cell>abort</cell> - <cell>{reference(), Reason :: term()}</cell> + <cell>{select_ref(), Reason :: term()}</cell> </row> <tcaption>socket message info value type</tcaption> </table> - <p>The <c>reference()</c> is the same as was received in the + <p>The <c>select_ref()</c> is the same as was received in the <seealso marker="socket#type-select_info"><c>SelectInfo</c></seealso>. </p> </section> </section> |