Info (Socket function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
 
(5 intermediate revisions by one other user not shown)
Line 10: Line 10:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%info</th>
<tr><th>%string</th>
<td>A string variable to contain the returned information.
<td>A string variable to contain the returned information.
</td></tr>
</td></tr>
Line 16: Line 16:
<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>
</td></tr>
<tr><th>infotype</th>
<tr><th>string</th>
<td>One of the following strings:  
<td>One of the following strings:  
<table class="syntaxTable">  
<table class="syntaxTable">  
<tr><th><var>CAPTURE</var></th>  
<tr><th><var>CAPTURE</var></th>  
<td>Retrieve current print capture setting of socket (see <var>[[Capture (Socket function)|Capture]]</var>). The socket need not be OPEN. </td></tr>  
<td>Retrieve current print capture setting of socket (see <var>[[Capture (Socket function)|Capture]]</var>). The socket need not be <var>OPEN</var>. </td></tr>  
<tr><th><var>REMOTE</var></th>  
<tr><th><var>REMOTE</var></th>  
<td>Retrieve dotted IP address of remote host, followed by blank and remote port number. The socket must be <var>OPEN</var>; if it is not, the string <code>RESET</code> is returned. </td></tr>  
<td>Retrieve dotted IP address of remote host, followed by blank and remote port number. The socket must be <var>OPEN</var>; if it is not, the string <code>RESET</code> is returned. </td></tr>  
Line 55: Line 55:
depend on several factors:
depend on several factors:
<ul>
<ul>
<li>If the <var class="term">infotype</var> argument is <code>ONRESET</code>, the operation is
<li>If the <var class="term">string</var> argument is <code>ONRESET</code>, the operation is
performed normally, with
performed normally, with
no indication of the fact that the socket is <var>RESET</var>.
no indication of the fact that the socket is <var>RESET</var>.
<li>Otherwise, if <var class="term">infotype</var> is a keyword that does not require an
<li>Otherwise, if <var class="term">string</var> is a keyword that does not require an
<var>OPEN</var> socket, and <code>ONRESET CONTINUE</code>, <code>CANCELC</code>, or <code>LABELC</code> is in effect for the socket,
<var>OPEN</var> socket, and <code>ONRESET CONTINUE</code>, <code>CANCELC</code>, or <code>LABELC</code> is in effect for the socket,
the string <code>RESET</code> is returned, and the last error information is set.
the string <code>RESET</code> is returned, and the last error information is set.
Line 64: Line 64:
the string <code>RESET</code> is returned, and the last error information is set.
the string <code>RESET</code> is returned, and the last error information is set.
<li>Otherwise, the request is canceled, or the <var>ONRESET</var> label is jumped to,
<li>Otherwise, the request is canceled, or the <var>ONRESET</var> label is jumped to,
as explained in [[Janus Sockets User Language coding considerations#Handling connection errors and RESET sockets|" Handling connection errors and RESET sockets"]].
as explained in [[Janus Sockets User Language coding considerations#Handling connection errors and RESET sockets|"Handling connection errors and RESET sockets"]].
</ul>
</ul>
</ul>
</ul>


{{Template:Socket:Info footer}}
{{Template:Socket:Info footer}}

Latest revision as of 20:39, 10 October 2012

Retrieve information about the socket (Socket class)


This method retrieves the information that you request about the socket. The Info function has an effect similar to its equivalent $function, $Sock_Info.

Syntax

%string = socket:Info( string)

Syntax terms

%string A string variable to contain the returned information.
socket A variable or an expression that is a reference to a Socket object.
string One of the following strings:
CAPTURE Retrieve current print capture setting of socket (see Capture). The socket need not be OPEN.
REMOTE Retrieve dotted IP address of remote host, followed by blank and remote port number. The socket must be OPEN; if it is not, the string RESET is returned.
STAT Retrieve socket state. The socket need not be OPEN. The returned value will be one of the following:
CONN Socket OPEN and enabled for sending in both directions
FINR Socket OPEN, remote stopped sending, local enabled for sending ("FIN received but not sent")
FINS Socket OPEN, local stopped sending, remote enabled for sending ("FIN sent but not received")
FINBOTH Socket OPEN, local and remote stopped sending ("FIN sent and received")
RESET Socket is RESET (no longer connected)

Note: Since the status of OPEN sockets may include several more status types in future releases, test for OPEN sockets by testing for the string RESET:

If %sock:Info('STATUS') ne 'RESET' ...

opt Any of the strings that may be passed as the first argument to the Set function (for example, CHAR or PRSTOK). For some of these, the socket must be OPEN; if not, the string RESET is returned. To view the arguments that require an OPEN socket, see Set.

Usage notes

  • If Info is invoked with a Socket object that is RESET, the results depend on several factors:
    • If the string argument is ONRESET, the operation is performed normally, with no indication of the fact that the socket is RESET.
    • Otherwise, if string is a keyword that does not require an OPEN socket, and ONRESET CONTINUE, CANCELC, or LABELC is in effect for the socket, the string RESET is returned, and the last error information is set.
    • Otherwise, if ONRESET CONTINUE is in effect for the socket, the string RESET is returned, and the last error information is set.
    • Otherwise, the request is canceled, or the ONRESET label is jumped to, as explained in "Handling connection errors and RESET sockets".