NAME

xsocket - create an xio socket

SYNOPSIS

#include <xio/socket.h>

int xsocket(int pf, int socktype);

DESCRIPTION

Creates an xio socket with specified pf and socktype. Returns a file descriptor for the newly created xio socket.

Following pfs are defined at the moment:

XPF_TCP

TCP transport mechanism

XPF_IPC

inter-process transport mechanism

XPF_INPROC

in-process transport mechanism

socktype parameter defines the type of the socket, which in turn determines the exact semantics of the socket.

Following socktypes are defined at the moment:

XLISTENER

xio listener socket, that is, as a socket that will be used to accept incoming connection requests using xbind[3] or using helper API xlisten[3]

XCONNECTOR

xio connector socket, a socket that will be used to connect to remote listening xio socket using xbind[3] or using helper API xconnect[3]

The newly created xio socket exists in a name space (address family) but has no address assigned to it. see xbind(3) function.

RETURN VALUE

On success, a xio socket descriptor for the new socket is returned. On error, -1 is returned, and errno is set appropriately.

Note that xio socket file descriptors returned are not standard system file descriptors and will exhibit undefined behaviour when used with system functions. Moreover, it may happen that a system file descriptor and file descriptor of an xio socket will incidentally collide (be equal).

ERRORS

EPROTO

Specified address family is not supported or unknown protocol.

EMFILE

The limit on the total number of open xio sockets or OS limit for file descriptors has been reached.

EXAMPLE

int s = xsocket (XPF_TCP, XLISTENER);

or

int s = xsocket (XPF_TCP|XPF_IPC, XLISTENER);

SEE ALSO

xbind(3) xlisten(3) xconnect(3) xclose(3) xio(7)

AUTHORS

Dong Fang <yp.fangdong@gmail.com>
Martin Sustrik <sustrik@250bpm.com>