#include <rtl.h>
int accept (
int sock, /* Socket descriptor */
SOCKADDR *addr, /* Pointer to address structure */
int *addrlen); /* Length of address structure */
Description
The accept function accepts a connection request queued for
a listening socket. If a connection request is pending, accept
removes the request from the queue, and a new socket is created for
the connection. The original listening socket remains open and
continues to queue new connection requests. The socket sock
must be a SOCK_STREAM type socket.
In blocking mode, which is enabled if the system detects RTX
environment, this functions waits for a connection request. In non
blocking mode, you must call the accept function again if the
error code SCK_EWOULDBLOCK is returned.
The argument sock specifies a socket descriptor returned
from a previous call to socket.
The argument addr is a pointer to the SOCKADDR structure
that will receive the connection node IP addres and port number.
The argument addrlen is a pointer to the address length. It
should initially contain the amount of space pointed to by
addr. On return it contains the actual length of the address
returned in bytes.
The accept function is in the RL-TCPnet library. The
prototype is defined in rtl.h.
note
You must call the socket function before any other
function calls to the BSD socket.
If a negative number is returned, it represents an error
code.
Return Value
The accept function returns the following result:
handle
The accepted BSD socket handle (a positive number).
SCK_EINVALID
The socket identified with sock is invalid.
SCK_EWOULDBLOCK
The function would block, and the socket is set to non blocking
mode.
SCK_ECLOSED
The connect request has been canceled, connection closed.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.