$Sock Send: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(Automatically generated page update)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Sock_Send}}
{{DISPLAYTITLE:$Sock_Send}}
<span class="pageSubtitle">Send string</span>
<span class="pageSubtitle">Send string</span>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented
methods. There is currently no direct OO equivalent for this $function.</p>
methods. The OO equivalent for <var>$Sock_Send</var> is the <var>[[Send (Socket function)|Send]]</var> method.</p>


<var>$Sock_Send</var> sends a string over a <var class="product">Janus Sockets</var> connection.
<var>$Sock_Send</var> sends a string over a <var class="product">Janus Sockets</var> connection.
Line 9: Line 9:


==Syntax==
==Syntax==
<p class="syntax"><span class="squareb">[</span><span class="term">%rc</span><span class="literal"> =</span><span class="squareb">]</span><span class="literal"> $Sock_Send(</span><span class="term">sockno</span><span class="literal">, </span><span class="term">string</span><span class="literal">, </span><span class="squareb">[</span><span class="term">opts</span><span class="squareb">]</span><span class="literal">)</span>  </p>
<p class="syntax"><span class="squareb">[</span><span class="term">%rc</span><span class="literal"> =</span><span class="squareb">]</span><span class="literal"> $Sock_Send(</span><span class="term">sockNum</span><span class="literal">, </span><span class="term">string</span><span class="literal">, </span><span class="squareb">[</span><span class="term">opts</span><span class="squareb">]</span><span class="literal">)</span>  </p>


===Syntax terms===
===Syntax terms===
Line 15: Line 15:
<tr><th>%rc</th>
<tr><th>%rc</th>
<td>A numeric value that is a numeric error code (described further [[#$Sock_Send return codes|below]]), or if the operation could not be performed as requested, a 0 value. For more details, see [[#$Sock_RecvPrs return values|"$Sock_RecvPrs return values"]]. </td></tr>
<td>A numeric value that is a numeric error code (described further [[#$Sock_Send return codes|below]]), or if the operation could not be performed as requested, a 0 value. For more details, see [[#$Sock_RecvPrs return values|"$Sock_RecvPrs return values"]]. </td></tr>
<tr><th>sockno</th>  
<tr><th>sockNum</th>  
<td>The socket number. </td></tr>  
<td>The socket number. </td></tr>  
<tr><th>string</th>  
<tr><th>string</th>  

Latest revision as of 00:00, 21 September 2018

Send string

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Sock_Send is the Send method.

$Sock_Send sends a string over a Janus Sockets connection.

It is also a callable function.

Syntax

[%rc =] $Sock_Send(sockNum, string, [opts])

Syntax terms

%rc A numeric value that is a numeric error code (described further below), or if the operation could not be performed as requested, a 0 value. For more details, see "$Sock_RecvPrs return values".
sockNum The socket number.
string The string to send.
opts This optional argument is an option string, which can contain any of the following:
BINARY Indicates that regardless of the socket's BINARY or CHAR parameter, data is not translated when sent. The argument can be the result of a previous translation using $Sock_Tran_Out.
CHAR Indicates that regardless of the socket's BINARY or CHAR parameter, data is translated when sent. The translation is specified by the output table defined in the socket's XTAB parameter.
FIN Indicates that after the string argument is sent, no more data will be sent on the socket. This transmits the FIN indication to the remote partner. Note that when FIN is sent, print capturing is automatically turned OFF for the socket.
PUSH Ensures that the data being sent on the socket is immediately sent to the receiver. Normally, data to be sent is buffered and may not be sent immediately.

Using PUSH is not necessary if:

  • You are specifying FIN, since a push operation is implied by FIN.
  • You are alternating sends and receives on a socket, since receive-processing functions ($Sock_Recv and $Sock_RecvPrs) always do a push before receiving.

$Sock_Send return codes

  • 0, if the function completes successfully.
  • -1, if the socket is not open and ONRESET CONTINUE is in effect for the socket.

If you need to send line-end delimited information, use $Sock_SendLn.