$Sock Num: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle">Get selected socket numbers</span>
<span class="pageSubtitle">Get selected socket numbers</span>
<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented
<p class="warn"><b>Note: </b>Most Sirius $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_Num</var> is the <var>[[Num (Socket function)|Num]]</var> method.</p>


<var>$Sock_Num</var> retrieves selected socket numbers.
<var>$Sock_Num</var> retrieves selected socket numbers.

Revision as of 21:47, 23 July 2013

Get selected socket numbers

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Sock_Num is the Num method.

$Sock_Num retrieves selected socket numbers.

Syntax

%nums = $Sock_Num[([selection])]

Syntax terms

%nums A string that contains blank-separated selected socket numbers in ascending order.
selection A string that identifies which socket numbers to return. It is any combination of the following strings separated by OR, and each optionally prefixed by NOT:
ANY Return all sockets. This is the default.
CONN Return sockets enabled for sending in both directions.
FINR Return sockets on which local partner is enabled for sending but remote has stopped sending ("FIN received").
FINS Return sockets on which remote partner is enabled for sending but local stopped sending ("FIN sent").
FINBOTH Return OPEN sockets on which remote and local partners both stopped sending ("FIN sent and received").
RESET Return in-use but no longer connected sockets.
OPEN Return OPEN sockets. This is equivalent to either of the following:
  • NOT RESET
  • CONN OR FINR OR FINS OR FINBOTH
CAPTURE Return sockets (OPEN or not) for which print capturing is on.
CAPOPEN Return OPEN sockets for which print capturing is on.

If NOT prefixes one of the above specifications, then all in-use sockets (excluding the specified set) are included in the selected set. With multiple terms separated by OR, the specified sets are combined by the set union operation.

Usage notes

$Sock_Num does not have a socket number argument, and thus it is not affected by any ONRESET setting.

Examples

  1. In the following example, %sock contains the blank-delimited values of %c1 and %c2. Assuming no other client socket numbers were in use, this would result in %sock = '2 3'.

    JANUS DEFINE PIPE * CLSOCK 5 REMOTE * * SOCKPMAX 2 Begin %c1 is Float %c2 is Float %sock is String Len 255 %c1 = $Sock_conn('PIPE', 'www.ampas.org', 80) %c2 = $Sock_conn('PIPE', 'www.wga.org', 80) %sock = $Sock_Num ...

  2. The following example shows another way to retrieve the list of all OPEN socket numbers:

    %sock = $Sock_Num('NOT RESET')

  3. The following example shows how to retrieve the list of all OPEN socket numbers that have not received the FIN indicator:

    %sock = $Sock_Num('CONN OR FINS')