$Sock Info: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Sock_Info}}
{{DISPLAYTITLE:$Sock_Info}}
<span class="pageSubtitle">Get info about a socket</span>
<span class="pageSubtitle">Get info about a socket</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_Info</var> is the <var>[[Info (Socket function)|Info]]</var> method.</p>


<var>$Sock_info</var> retrieves socket information.
<var>$Sock_info</var> retrieves socket information.

Latest revision as of 00:00, 21 September 2018

Get info about a socket

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

$Sock_info retrieves socket information.

Syntax

%info = $Sock_Info(socket, infoType)

Syntax terms

%info A string that contains the requested information.
socket A string that is the socket identifier.
infoType One of the following string indicators of the information to be retrieved about the socket:
Value Description
CAPTURE Retrieve current print capture setting of socket (see $Sock_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(%sk, 'STATUS') Ne 'RESET' ...

opt Any of the strings that may be passed as the second argument to $Sock_Set (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 $Sock_Set.

The $Sock_Info function returns either the requested value or, as noted above, the string "RESET". If $Sock_Info is invoked with a socket that is RESET, the results depend on several factors:

  • If argument two is ONRESET, the operation is performed normally, and there is no indication of the fact that the socket is RESET.
  • Otherwise, if argument two is a keyword which 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".