riot_sys

Function sock_tcp_accept

Source
pub unsafe extern "C" fn sock_tcp_accept(
    queue: *mut sock_tcp_queue_t,
    sock: *mut *mut sock_tcp_t,
    timeout: u32,
) -> c_int
Expand description

@brief Receives and handles TCP connection requests from other peers

@pre (queue != NULL) && (sock != NULL)

@param[in] queue A TCP listening queue. @param[out] sock A new TCP sock object for the established sock object. @param[in] timeout Timeout for accept in microseconds. If 0 and no data is available, the function returns immediately. May be @ref SOCK_NO_TIMEOUT for no timeout (wait until data is available).

@return 0 on success. @return -EAGAIN, if @p timeout is 0 and no data is available. @return -ECONNABORTED, if the connection to @p sock has been aborted while in this function @return -EINVAL, if @p queue was not initialized using @ref sock_tcp_listen(). @return -ENOMEM, if system was not able to allocate sufficient memory to establish connection. @return -EPERM, if connections on local end point of @p queue are not permitted on this system (e.g. by firewall rules). @return -ETIMEDOUT, if the operation timed out internally.