XSocket API  2.0
XIA Socket Library
Functions
Xconnect.c File Reference

Xconnect() - initiate a connection on a socket. More...

#include "Xsocket.h"

Functions

int Xconnect (int sockfd, const sockaddr *addr, socklen_t addrlen)
 Initiate a connection on a socket. More...
 

Function Documentation

int Xconnect ( int  sockfd,
const sockaddr *  addr,
socklen_t  addrlen 
)

The Xconnect() call connects the socket referred to by the sockfd to the address specified by addr.

If sockfd is of type SOCK_DGRAM, then addr is the address to which datagrams are sent by default, and the only address from which datagrams are received.

If the socket is of type SOCK_STREAM this call attempts to make a connection to the socket that is bound to the address specified by addr.

SOCK_STREAM sockets may successfully Xconnect() only once; SOCK_DGRAM sockets may use Xconnect() multiple times to change their association. SOCK_DGRAM sockets may dissolve the association by connecting to an address with the sa_family member of sockaddr set to AF_UNSPEC.

Note
See the man page for the standard connect() call for more details.
Parameters
sockfdThe control socket
addrThe address (SID) of the remote service to connect to.
addrlenThe length of addr
Returns
0 on success
-1 on error with errno set to an error compatible with those returned by the standard connect call.