NetApp_SockAccept TCP
Return a new application socket accepted from a listen application socket, with error handling. See NetSock_Accept() for more information.
Files
net_app.h/net_app.c
Prototype
NET_SOCK_ID NetApp_SockAccept (NET_SOCK_ID sock_id, NET_SOCK_ADDR *p_addr_remote, NET_SOCK_ADDR_LEN *p_addr_len, CPU_INT16U retry_max, CPU_INT32U timeout_ms, CPU_INT32U time_dly_ms, NET_ERR *p_err);
Arguments
sock_id
This is the socket ID returned by NetApp_SockOpen()/ NetSock_Open()/socket()
when the socket was created. This socket is assumed to be bound to an address and listening for new connections (see section NetSock_Open()).
p_addr_remote
Pointer to a socket address structure (see section Network Sockets Concepts) to return the remote host address of the new accepted connection.
p_addr_len
Pointer to the size of the socket address structure which must be passed the size of the socket address structure [e.g., sizeof(NET_SOCK_ADDR_IPv4)
]. Returns size of the accepted connection’s socket address structure, if no errors; returns 0
, otherwise.
retry_max
Maximum number of consecutive socket accept retries.
timeout_ms
Socket accept timeout value per attempt/retry.
time_dly_ms
Socket accept delay value, in milliseconds.
p_err
Pointer to variable that will receive the error code from this function:
NET_APP_ERR_NONE
NET_APP_ERR_NONE_AVAIL
NET_APP_ERR_INVALID_ARG
NET_APP_ERR_INVALID_OP
NET_APP_ERR_FAULT
NET_APP_ERR_FAULT_TRANSITORY
Returned Value
Socket descriptor/handle identifier of new accepted socket, if no errors.
NET_SOCK_BSD_ERR_ACCEPT
, otherwise.
Required Configuration
None.
Notes / Warnings
Some socket arguments and/or operations are validated only if validation code is enabled (see section Argument Check Configuration).
If a non-zero number of retries is requested (retry_max
) and socket blocking is configured for non-blocking operation; then a non-zero timeout (timeout_ms
) and/or a non-zero time delay (time_dly_ms
) should also be requested. Otherwise, all retries will most likely fail immediately since no time will elapse to wait for and allow socket operations to successfully complete.