Accepts a connection on a socket.
This call gets the first connection request from the queue of pending connections and creates a new socket with the same properties as s. The call accepts the connection on the new socket and returns a file descriptor for that socket. You cannot accept more connections on the new socket; the original socket s remains open.
If no pending connections are present on the queue and the socket is not marked as non-blocking, this call blocks the caller until a connection request arrives. If the socket is marked non-blocking and no pending connections are present on the queue, this call returns an error.
int accept( int s, struct sockaddr* addr, int* addrlen );
s
addr
addrlen
addr
. On return, addrlen contains the actual length in bytes of the returned address. -1
, and the function sets errno
to one of these values:
EBADF |
Invalid file descriptor or file not opened for writing. |
ENOSPC |
No space left on device. |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/sys/socket.h | sys/types.h sys/socket.h |
netiff3m.lib |