z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


GETCLIENTID

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

Use the GETCLIENTID command to retrieve the client ID for the calling application. The client ID is the identifier by which the calling application is known to the TCP/IP address space.

Tip: The client ID that is returned by the GETCLIENTID command can be used with the GIVESOCKET and TAKESOCKET commands.

Format

Read syntax diagramSkip visual syntax diagram
                             .-,--AF_INET-.      
>>-SOCKET--(--"GETCLIENTID"--+------------+--)-----------------><
                             '-,--domain--'      

Parameters

domain
The domain. This parameter is optional for IPv4, but it is required for IPv6. If this parameter is not specified, by default, the domain parameter is set to AF_INET. The following domain values are supported:
  • AF_UNSPEC or 0
  • AF_INET or 2
  • AF_INET6 or 19

Returned value

The command returns a string that contains the return code and the application identifier. 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 application identifier has the following format:
clientid = domain userid socketset
The following examples show what is returned for the specific address families:
IPv4
0 AF_INET IBMUSER SOCSET01
IPv6
0 AF_INET6 IBMUSER SOCSET01

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 numbers can be returned:
  • 2001 EINVALIDRXSOCKETCALL
  • 2005 ESUBTASKNOTACTIVE
  • 2013 EINVALIDCLIENTID

LE C/C++ equivalent

int getclientid(int domain, struct clientid *clientid);

Code example

Figure 1. GETCLIENTID command example
/* REXX EZARXR06 */
/*
 * This sample demonstrates the use of the GETCLIENTID
 * socket command.
 */
src = socket("INITIALIZE","MYSET01");
if perror(src,"INITIALIZE") \= 0 then signal ENDPROGRAM;
src = socket("GETCLIENTID");
Say src;

ENDPROGRAM:
src = socket("TERMINATE","MYSET01");
src = perror(src,"TERMINATE");

exit 0;

/* This routine returns -1 if the first word if arg 1 is not zero */
perror: if word(arg(1),1) = 0 then return 0; else
    Say arg(2) "Error : "arg(1);
    return -1;

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014