Use the SOCKETSETSTATUS
command to list information about a socket set.
Format
>>-SOCKET--(--"SOCKETSETSTATUS"--+--------------+--)-----------><
'-,--subtaskid '
Parameters
- subtaskid
- An optional parameter that specifies the name of the socket set.
If this parameter is not specified, then the SOCKETSETSTATUS command
returns the status of the active socket set.
Returned value
The command returns a string that contains the return
code, the name of the socket set, the state of the socket set, the
number of sockets that are available for use, and the number of sockets
that currently are being used. The return code can be 0 or the REXX API error number. The return code 0 indicates that the requested socket command was completed successfully.
The state of a socket set is one of the following values:
- CONNECTED
- Indicates that the socket set has been initialized with the INITIALIZE
command
- SEVERED
- Indicates that the socket set has been initialized using the INITIALIZE
command, but a problem exists with the socket set
- FREE
- Indicates that the socket set has not been initialized
The following string is an example of what
is returned by the SOCKETSETSTATUS command:
0 MYSET Connected Free 15 Used 1
In the example, 0 is the return code,
MYSET is the
name of the socket set,
CONNECTED is the status of
the socket set,
15 is the number of the free sockets,
and
1 is the number of sockets that are in use.
See Socket call error return codes for additional information about the numeric error codes that are returned by this command.
The following REXX socket API error number can be returned::
LE C/C++ equivalent
This command has no LE C/C++ equivalent.
Code example
Figure 1. SOCKETSETSTATUS command
example/* REXX EZARXR29 */
/*
* This sample demonstrates the use of the SOCKSETSTATUS
* socket command. Error checking is not performed for the
* socket commands as the intent is to show what the command
* will return when multiple INITIALIZE commands are
* issued.
*/
x1=socket("INITIALIZE","MYTEST",15);
x2=socket("SOCKETSET");
x3=socket("SOCKETSETSTATUS");
x4=socket("SOCKET","AF_INET");
parse var x4 l_retcode l_x4_socketid;
if l_retcode = 0 then do
x5=socket("SOCKETSETSTATUS");
Say "FIRST INITIALIZE command:"
Say " INITIALIZE = "x1;
Say " SOCKETSET = "x2;
Say " SOCKETSETSTATUS = "x3;
Say " SOCKET = "l_retcode l_x4_socketid;
Say " SOCKETSETSTATUS = "x5;
Say "*** END";
y1=socket("INITIALIZE","REXXSET",15);
y2=socket("SOCKETSET");
y3=socket("SOCKETSETSTATUS");
y4=socket("SOCKETSETSTATUS","MYTEST");
y5=socket("SOCKET","AF_INET");
parse var y5 l_retcode l_y5_socketid;
if l_retcode = 0 then do
y6=socket("SOCKETSETSTATUS");
Say "SECOND INITIALIZE command:"
Say " INITIALIZE = "y1;
Say " SOCKETSET = "y2;
Say " SOCKETSETSTATUS = "y3;
Say " SOCKETSETSTATUS = "y4;
Say " SOCKET = "l_retcode l_y5_socketid
Say " SOCKETSETSTATUS = "y6;
Say "*** END";
rc2=socket("CLOSE",l_y5_socketid);
say "rc2 = "rc2;
xx=socket("SOCKETSETSTATUS","MYTEST");
end;
rc1=socket("CLOSE",l_x4_socketid);
Say "rc1 = "rc1;
end;
x=socket("TERMINATE","MYTEST");
x=socket("TERMINATE","REXXSET");
exit;