For stream sockets, the connect callable service establishes a connection from a client socket to a socket at a server. For UDP (Universal Datagram Protocol) sockets, the connect callable service specifies the peer for a socket.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task or SRB |
Cross memory mode: | PASN = HASN |
AMODE (BPX1CON): | 31-bit task or SRB mode |
AMODE (BPX41CON): | 64-bit task mode only |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4CON with the same parameters.
The name of a fullword that contains the socket file descriptor for which the connect is to be done.
The name of a field that contains the length of Sockaddr.
The name of a field that contains the address of the socket or the name of the peer to which a connection is to be attempted.
Return_code | Explanation |
---|---|
EACCES | For AF_UNIX sockets, search permission is denied for a component of the path prefix, or write access to the named socket is denied. |
EAFNOSUPPORT | The address family that was specified in the address structure is not supported. |
EBADF | The socket descriptor is incorrect. The following reason codes can accompany the return code: JRFileDesNotInUse, JRFileNotOpen. |
ECONNREFUSED | The attempt to connect was rejected. The connect request may exceed the backlog count of the target socket, or the target socket may be closed. The following reason codes can accompany the return code: JRSocketNotFound, JRExceedsBacklogCount, JRListenNotDone. |
EINVAL | The length that is specified in the Sockaddr_length or in the name length field in the Sockaddr is not valid. The following reason codes can accompany the return code: JRSocketCallParmError, JRSockNoName. |
EINTR | A signal interrupted the connect service before this connection was accepted. The following reason code can accompany the return code: JRSignalReceived. |
EIO | There has been a network or transport failure. The following reason codes can accompany the return code: JRPrevSockError, JRTransportDriverNotAccessible. |
EISCONN | The socket is already connected. |
ENOBUFS | A buffer could not be obtained. The following reason code can accompany the return code: JROutofSocketCells. |
ENOTSOCK | Socket_descriptor does not refer to a valid socket descriptor. The following reason code can accompany the return code: JRMustBeSocket. |
EOPNOTSUPP | The socket is ready to accept connections. An accept request was expected. The following reason code can accompany the return code: JRListenAlreadyDone. |
EPROTOTYPE | The address specifies a socket that is not the correct type for this request. The following reason code can accompany the return code: JRIncorrectSocketType. |
EWOULDBLOCK | The socket is marked nonblocking, and the connection cannot be completed immediately. |
The name of a fullword in which the connect service stores the reason code. The connect service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.
There are no restrictions on the use of the connect service.
For an example using this callable service, see BPX1CON (connect) example.