Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NetApp_SockRx() (TCP/UDP)

...

Receive application data via socket, with error handling. See section C-13-46 on page 659 for more information.anchor12861481286148

Files

...

net_app.h/net_app.canchor12861531286153 Prototype

...

Prototype

 

Arguments

sock_id

This is the socket ID returned by NetApp_SockOpen()/ NetSock_Open()/socket() when the socket was created or by NetApp_SockAccept()/NetSock_Accept()/accept() when a connection was accepted.

Anchor12880741288074pdata_buf Anchor14532321453232

Pointer to the application memory buffer to receive data.

Anchor14532331453233data_buf_len Anchor14532341453234

Size of the destination application memory buffer (in bytes).

Anchor12881191288119data_rx_th Anchor12881341288134

Application data receive threshold:

...

...

0, no minimum receive threshold; i.e. receive any amount of data. Recommended for datagram sockets;

...

Minimum amount of application data to receive (in bytes) within maximum number of retries, otherwise.

...

12880781288078flags Anchor12880791288079

Flag to select receive options; bit-field flags logically

...

classWebWorks_Indent_1

...

OR’d:

NET_SOCK_FLAG_NONE/0

...

...

No socket flags selected

...

...

NET_SOCK_FLAG_RX_DATA_PEEK/

...

classWebWorks_Indent_2

...

 

...

...

classWebWorks_Indent_1

...

MSG_PEEK

...

classWebWorks_Indent_2

...

...

Receive socket data without consuming it

...

...

NET_SOCK_FLAG_RX_NO_BLOCK/

...

classWebWorks_Indent_2

...

 

...

classWebWorks_Indent_1

...

MSG_DONTWAIT

...

classWebWorks_Indent_2

...

...

Receive socket data without blocking

...

...

 

...

In most cases, this flag would be set to NET_SOCK_FLAG_NONE/0.

Anchor12880911288091paddr_remote Anchor12880941288094

Pointer to a socket address structure (see section 8-2 “Socket Interface”

...

) to return the remote host address that sent the received data.

Anchor12880961288096paddr_len Anchor12880971288097

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_IP)]. Returns size of the accepted connection’s socket address structure, if no errors; returns 0, otherwise.

Anchor12861571286157retry_max Anchor12861581286158

Maximum number of consecutive socket receive retries.

...

12861591286159timeout_ms Anchor12861601286160

Socket receive timeout value per attempt/retry.

...

12861611286161time_dly_ms Anchor12861621286162

Socket receive delay value, in milliseconds.

...

1286163perr Anchor12861641286164

Pointer to variable that will receive the error code from this function:

...

classWebWorks_Indent_1

...

NET_APP_ERR_NONE

...

...

 

...

...

NET_APP_ERR_INVALID_ARG

...

 

...

classWebWorks_Indent_1

...

...

NET_APP_ERR_INVALID_OP

...

 

...

classWebWorks_Indent_1

...

NET_APP_ERR_FAULT

...

 

...

...

NET_APP_ERR_FAULT_TRANSITORY

...

...

 

...

classWebWorks_Indent_1

...

...

NET_APP_ERR_CONN_CLOSED

...

...

 

...

classWebWorks_Indent_1

...

NET_APP_ERR_DATA_BUF_OVF

...

 

...

classWebWorks_Indent_1

...

NET_ERR_RX

...

...

 

...

Returned Value

Anchor12889151288915Number of data bytes received, if no errors. Anchor

128891712889170, otherwise. Anchor12889091288909

Required Configuration

Anchor12861821286182Available only if NET_APP_CFG_API_EN is enabled (see section D-18-1 on page 768) and either NET_CFG_TRANSPORT_LAYER_SEL is configured for TCP (see section D-12-1 on page 755) and/or NET_UDP_CFG_APP_API_SEL is configured for sockets (see section D-13-1 on page 756). Anchor12861891286189

Notes / Warnings

...

12861901286190Some socket arguments and/or operations are validated only if validation code is enabled (see section D-3-1 on page 744). Anchor12891431289143

If a non-zero number of retries is requested (retry_max) and socket blocking is configured for non-blocking operation (see section D-15-3 on page 761); 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.