Socket


 #include <cio/socket.h> 

Functions

int cio_connect (int sockfd, const struct sockaddr *addr, socklen_t addrlen)
int cio_accept (int sockfd, struct sockaddr *addr, socklen_t *addrlen)
int cio_accept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
ssize_t cio_recv (int sockfd, void *buf, size_t len, int flags)
ssize_t cio_send (int sockfd, const void *buf, size_t len, int flags)

Function Documentation

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

Accept a connection on a socket.

Parameters:
sockfd socket file descriptor
addr buffer for socket address or NULL
addrlen size of the address buffer or NULL
Return values:
>=0 a new connection socket file descriptor
-1 on error with errno set
Precondition:
fd should be in non-blocking mode
See also:
accept(2)
int cio_accept4 ( int  sockfd,
struct sockaddr *  addr,
socklen_t *  addrlen,
int  flags 
)

Accept a connection on a socket. ENODATA on close.

Parameters:
sockfd socket file descriptor
addr buffer for socket address or NULL
addrlen size of the address buffer or NULL
flags for the new file descriptor
See also:
accept4(2)
int cio_connect ( int  sockfd,
const struct sockaddr *  addr,
socklen_t  addrlen 
)

Initiate a connection on a socket.

Parameters:
sockfd socket file descriptor
addr socket address
addrlen size of the address
Return values:
0 on success
-1 on error with errno set
Precondition:
fd should be in non-blocking mode
See also:
connect(2)
ssize_t cio_recv ( int  sockfd,
void *  buf,
size_t  len,
int  flags 
)

TODO

ssize_t cio_send ( int  sockfd,
const void *  buf,
size_t  len,
int  flags 
)

TODO