Function riot_sys::gnrc_tcp_recv

source ·
pub unsafe extern "C" fn gnrc_tcp_recv(
    tcb: *mut gnrc_tcp_tcb_t,
    data: *mut c_void,
    max_len: size_t,
    user_timeout_duration_ms: u32
) -> ssize_t
Expand description

@brief Receive Data from the peer.

@pre gnrc_tcp_tcb_init() must have been successfully called. @pre @p tcb must not be NULL. @pre @p data must not be NULL.

@note Function blocks if user_timeout_duration_us is not zero.

@param[in,out] tcb TCB holding the connection information. @param[out] data Pointer to the buffer where the received data should be copied into. @param[in] max_len Maximum amount to bytes that should be read into @p data. @param[in] user_timeout_duration_ms Timeout for receive in milliseconds. If zero and no data is available, the function returns immediately. If not zero the function blocks until data is available or @p user_timeout_duration_ms milliseconds passed. If GNRC_TCP_NO_TIMEOUT, causing the function to block until some data was available or an error occurred.

@return The number of bytes read into @p data. @return 0, if the connection is closing and no further data can be read or @p max_len was 0. @return -ENOTCONN if connection is not established. @return -EAGAIN if user_timeout_duration_us is zero and no data is available. @return -ECONNRESET if connection was reset by the peer. @return -ECONNABORTED if the connection was aborted. @return -ETIMEDOUT if @p user_timeout_duration_ms expired.