Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
spt_connectx(2) OSS System Calls Reference Manual
NAME
spt_connectx - Connects a socket (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series and J series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <sys/socket.h>]
#include <spthread.h>
int spt_connectx(
int socket,
const struct sockaddr *address,
size_t address_len
);
PARAMETERS
socket Specifies the file descriptor for the socket.
address Points to a sockaddr structure that contains the address of the peer socket. The
length and format of the address depend on the address family of the socket.
For AF_INET sockets, a pointer to the address structure sockaddr_in must be
cast as a struct sockaddr.ForAF_INET6 sockets, a pointer to the address
structure sockaddr_in6 must be cast as a struct sockaddr.ForAF_UNIX sock-
ets, a pointer to the address structure sockaddr_un must be cast as a struct
sockaddr.
address_len Specifies the length of the sockaddr structure pointed to by the address parame-
ter.
DESCRIPTION
The spt_connectx() function is a thread-aware version of the connect() function.
The spt_connectx() function requests that a connection be made on a socket. The
spt_connectx() function performs a different action for each of the following types of initiating
sockets:
• If the initiating socket is not connection-oriented (has the type SOCK_DGRAM), the
spt_connectx() function sets the peer address but no connection is made. The peer
address identifies the socket where all datagrams are sent by subsequent calls to the
spt_sendx() function, and limits the remote sender for subsequent spt_recvx() function
calls. Datagram sockets can use the spt_connectx() function multiple times to commun-
icate with different peers.
If the socket is a datagram socket and address is a null address for the protocol, the
address for the peer socket is reset.
• If the initiating socket is connection-oriented (has the type SOCK_STREAM), the
spt_connectx() function attempts to make a connection to the socket specified by the
address parameter. Sockets of type SOCK_STREAM can successfully connect only
once.
When a connection cannot be created immediately and O_NONBLOCK is not set for the file
descriptor of the socket, the spt_connectx() call blocks until one of the following conditions
occurs:
7−146 Hewlett-Packard Company 527186-023