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

Xaccept(), Xaccept4() - accept/reject jobs sent to a destination. More...

#include "Xsocket.h"

Functions

int Xaccept (int sockfd, struct sockaddr *addr, socklen_t *addrlen)
 accept a connection on an Xsocket More...
 
int Xaccept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
 accept a connection on an Xsocket More...
 

Function Documentation

int Xaccept ( int  sockfd,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

The Xaccept system call is is only valid with Xsockets created with the SOCK_STREAM transport type. It accepts the first available connection request for the listening socket, sockfd, creates a new connected socket, and returns a new Xsocket descriptor referring to that socket. The newly created socket is not in the listening state. The original socket sockfd is unaffected by this call.

Parameters
sockfdan Xsocket previously created with the SOCK_STREAM type, and bound to a local DAG with Xbind()
addrif non-NULL, points to a block of memory that will contain the address of the peer on return
addrlenon entry, contains the size of addr, on exit contains the actual size of the address. addr will be truncated, if the size passed in is smaller than the actual size.
Note
See the man page for the standard accept() call for more details.
Returns
a non-negative integer that is the new Xsocket id
-1 on error with errno set to an error compatible with those returned by the standard accept call.
int Xaccept4 ( int  sockfd,
struct sockaddr *  addr,
socklen_t *  addrlen,
int  flags 
)

The Xaccept4 system call is is only valid with Xsockets created with the SOCK_STREAM transport type. It accepts the first available connection request for the listening socket, sockfd, creates a new connected socket, and returns a new Xsocket descriptor referring to that socket. The newly created socket is not in the listening state. The original socket sockfd is unaffected by this call.

Parameters
sockfdan Xsocket previously created with the SOCK_STREAM type, and bound to a local DAG with Xbind()
addrif non-NULL, points to a block of memory that will contain the address of the peer on return
addrlenon entry, contains the size of addr, on exit contains the actual size of the address. addr will be truncated, if the size passed in is smaller than the actual size.
flagsif SOCK_NONBLOCK is set, the new socket will be non-blocking. An error will be returned if any other bits in the flags are set.
Note
See the man page for the standard accept() call for more details.
Returns
a non-negative integer that is the new Xsocket id
-1 on error with errno set to an error compatible with those returned by the standard accept call.