SOCKET

The SOCKET call creates an endpoint for communication and returns a socket descriptor representing the endpoint.

Example of SOCKET call

SOC_FUNCTION DC   CL16'SOCKET'
AF           DC   F'19'
SOCTYPE      DS   F
STREAM       EQU  1
PROTO        DS   F
ERRNO        DS   F
RETCODE      DS   F
 
             CALL DFHSOKET,(SOC_FUNCTION,AF,SOCTYPE,PROTO,ERRNO,RETCODE)

Input parameters

SOC_FUNCTION
A 16-byte character field containing SOCKET. The field is left-justified and padded on the right with blanks.
AF
A fullword binary field set to the addressing family. Specify a value of 19, denoting an AF_INET6 socket. You can specify a value of 2 for migration purposes however, the socket will be limited to IPv4 connections only. A halfword binary field specifying the addressing family. For more information on AF_INET and AF_INET6, see the z/OS Communications Server: IP Configuration Guide.
SOCTYPE
A fullword binary field set to the type of socket required. Specify 1, denoting stream sockets. Stream sockets provide sequenced, 2-way byte streams that are reliable and connection-oriented. They support a mechanism for out-of-band data.
PROTO
Reserved. Do not specify a value in this field. The interface uses a protocol of TCP.

Output parameters

ERRNO
A fullword binary field. If RETCODE is negative, the field contains an error number. See Return codes for information about ERRNO return codes.
RETCODE
A fullword binary field that returns one of the following values:
Value
Description
≥0
Contains the new socket descriptor
-1
Check ERRNO for an error code