next up previous contents index
Next: 8.2.3 bind: bind a Up: 8.2 oskit_socket: Socket Interface Previous: 8.2.1 oskit_socket_factory_t: socket factories

8.2.2 accept: accept a connection on a socket

 

SYNOPSIS

#include <oskit/net/socket.h>

oskit_error_t oskit_socket_accept(oskit_socket_t *s, [out] struct oskit_sockaddr *name, [in/out] oskit_size_t *anamelen, [out] struct oskit_socket **newopenso);

DESCRIPTION

The accept method extracts the first connection request on the queue of pending connections, creates a new socket with the same properties of s and returns it. The socket must have been bound to an address with bind and it must be listening for connections after a listen.

If no pending connections are present on the queue, accept blocks the caller until a connection is present.

PARAMETERS

s
The socket from which connections are to accepted.

name
Filled with the address of the connecting entity as known to the communication layer.

anamelen
Initially, the amount of space pointed to by name, on return it will contain the amount actually used.

newopenso
Newly created socket.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.



University of Utah Flux Research Group