Send (Socket function): Difference between revisions
Jump to navigation
Jump to search
m (Automatically generated page update) |
mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Socket:Send subtitle}} | {{Template:Socket:Send subtitle}} | ||
This | This [[Notation conventions for methods#Callable functions|callable]] method sends a string over a <var class="product">Janus Sockets</var> connection. | ||
The <var>Send</var> function has an effect similar to <var>[[$Sock_Send]]</var>. | |||
==Syntax== | ==Syntax== | ||
{{Template:Socket:Send syntax}} | {{Template:Socket:Send syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%number</th><td> | <tr><th>%number</th> | ||
<td>This is a numeric variable to contain the returned indicator of success of the function. | |||
The return value is either of these: | |||
<table> | |||
<tr><th>0</th> | |||
<td>The function completed successfully.</td></tr> | |||
<tr><th>-1 </th> | |||
<td>The socket is not open, and <code>ONRESET CONTINUE</code> is in effect for the socket.</td></tr> | |||
</table></td></tr> | |||
<tr><th>socket</th> | <tr><th>socket</th> | ||
<td>Socket object</td></tr> | <td>A variable or an expression that is a reference to a <var>Socket</var> object.</td></tr> | ||
<tr><th>string</th> | <tr><th>string</th> | ||
<td>string</td></tr> | <td>The string to send.</td></tr> | ||
<tr><th><var>Options</var></th> | <tr><th><var>Options</var></th> | ||
<td>string</td></tr> | <td>This optional argument is an option string that may contain any | ||
of the following: | |||
<table class="syntaxTable"> | |||
<tr><th><var>BINARY</var></th> | |||
<td>Regardless of whether the <var>BINARY</var> or <var>CHAR</var> parameter is in effect for the socket's port, data <b>is not translated</b> when sent. The argument can be the result of a previous translation using the <var>[[TranOut (Socket function)|TranOut]]</var> method.</td></tr> | |||
<tr><th><var>CHAR</var></th> | |||
<td>Regardless of whether the <var>[[BINARY]]</var> or <var>[[CHAR]]</var> parameter is in effect for the socket's port, data <b>is translated</b> when sent. The translation is specified by the output table defined by the socket's <var>[[XTAB]]</var> parameter.</td></tr> | |||
<tr><th><var>FIN</var></th> | |||
<td>After <var class="term">string</var> is sent, no more data will be sent on the socket. This transmits the <code>FIN</code> indication to the remote partner. | |||
<p>Note that when <code>FIN</code> is sent, print capturing is automatically turned <var>OFF</var> for the socket.</p></td></tr> | |||
<tr><th><var>PUSH</var></th> | |||
<td>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. | |||
<p> Using <var>PUSH</var> is <b>not</b> necessary if: </p> | |||
<ul> | |||
<li>You are specifying <code>FIN</code>, since a push operation is implied by <var>FIN</var>. | |||
<li>You are alternating sends and receives on a socket, since receive-processing methods (<var>[[Receive (Socket function)|Receive]]Receive</var> and <var>[[ReceiveAndParse (Socket function)|ReceiveAndParse]]</var>) always do a push before receiving. | |||
</ul></td></tr></table> | |||
</td></tr> | |||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | |||
<li>If you need to send line-end delimited information, use the <var>[[SendWithLineEnd (Socket function)|SendWithLineEnd]]</var> method. | |||
</ul> | |||
==See also== | ==See also== | ||
{{Template:Socket:Send footer}} | {{Template:Socket:Send footer}} |
Latest revision as of 19:04, 11 June 2012
Send a string over this socket (Socket class)
This callable method sends a string over a Janus Sockets connection.
The Send function has an effect similar to $Sock_Send.
Syntax
[%number =] socket:Send( string, [[Options=] string])
Syntax terms
%number | This is a numeric variable to contain the returned indicator of success of the function.
The return value is either of these:
| ||||||||
---|---|---|---|---|---|---|---|---|---|
socket | A variable or an expression that is a reference to a Socket object. | ||||||||
string | The string to send. | ||||||||
Options | This optional argument is an option string that may contain any
of the following:
|
Usage notes
- If you need to send line-end delimited information, use the SendWithLineEnd method.