Close (Socket function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with " <span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span> Close function <p> <var>Close</var> is a member of the <var>[[Sock...")
 
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Template:Socket:Close subtitle}}
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
[[Category:Socket methods|Close function]]
<p>
<var>Close</var> is a member of the <var>[[Socket class|Socket]]</var> class.
</p>


This method terminates the sending and receiving of data on, and removes from use,
This method terminates the sending and receiving of data on, and removes from use,
Line 10: Line 5:
The <var>Close</var> method, which may be invoked with a <var>Call</var> statement, has an effect
The <var>Close</var> method, which may be invoked with a <var>Call</var> statement, has an effect
similar to its equivalent $function, <var>[[$Sock_Close]]</var>.
similar to its equivalent $function, <var>[[$Sock_Close]]</var>.
==Syntax==
==Syntax==
<p class="syntax">[%conn =] %socko:Close
{{Template:Socket:Close syntax}}
</p>
 
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%conn</th>
<tr><th>%number</th>
<td>If specified, this is a numeric variable to contain the returned value <code>1</code> from <var>Close</var>, indicating the connection is closed.
<td>If specified, this is a numeric variable to contain the returned value <code>1</code> from <var>Close</var>, indicating the connection is closed.
</td></tr>
</td></tr>
<tr><th>%socko</th>
<tr><th>socket</th>
<td>A variable or an expression that is a reference to a <var>Socket</var> object.
<td>A variable or an expression that is a reference to a <var>Socket</var> object.


</td></tr></table>
</td></tr></table>
==Usage notes==
==Usage notes==
<ul>
<ul>
Line 29: Line 26:
If the socket for which it is invoked is in the <code>RESET</code> state,
If the socket for which it is invoked is in the <code>RESET</code> state,
<var>Close</var> continues to the next statement and does not set the last socket error information.
<var>Close</var> continues to the next statement and does not set the last socket error information.
<li>This method must be used to close a WebSocket connection.
</ul>
</ul>


Line 37: Line 35:
<p class="code">%sok:Close
<p class="code">%sok:Close
</p>
</p>
{{Template:Socket:Close footer}}

Latest revision as of 17:14, 20 August 2019

Close this socket connection (Socket class)


This method terminates the sending and receiving of data on, and removes from use, a Janus Sockets connection. The Close method, which may be invoked with a Call statement, has an effect similar to its equivalent $function, $Sock_Close.

Syntax

[%number =] socket:Close

Syntax terms

%number If specified, this is a numeric variable to contain the returned value 1 from Close, indicating the connection is closed.
socket A variable or an expression that is a reference to a Socket object.

Usage notes

  • In addition to closing the socket, the Close method destroys (discards) the object.
  • Close is not affected by any ONRESET setting. If the socket for which it is invoked is in the RESET state, Close continues to the next statement and does not set the last socket error information.
  • This method must be used to close a WebSocket connection.

Example

The Close call signals that the program has completed all processing on the %sok socket:

%sok:Close