www.beck-ipc.com

@CHIP-RTOS C Library V2.06 - TCP/IP API


recvfrom

Receive message from another socket.

int recvfrom ( int sd, char far *bufptr, int bufLen,
               int flags, unsigned long timeout,
               struct sockaddr far *fromPtr,
               int *error );

Parameters

sd

Socket descriptor.

bufptr

Pointer to input buffer where received characters will be output.

bufLen

Maximum characters to store in buffer at bufptr .

flags

Wait option:
  • MSG_BLOCKING - Sleep until data comes in
  • MSG_TIMEOUT - The caller wakes up after timeout or if bufLen data bytes are received.
  • MSG_DONTWAIT - Return immediately after collecting what ever data is ready

timeout

Maximum milliseconds to wait if flags is set to MSG_TIMEOUT:

fromPtr

Output parameter:  Pointer to a sockaddr_in (IPv4) or sockaddr_in6 (IPv6, SC123/SC143 only! ) data structure, which will be set to indicate from where the received data originated.   This pointer can be set to NULL if this information is not desired.

error

Output parameter:  Failure code, 0 on success.

Return Value

-1: Failure, see error value reported
otherwise: Count of bytes received and placed in bufptr    (0 if time-out)

Comments

This API function applies only to UDP sockets.

The MSG_BLOCKING mode will not work if the socket has been put into non-blocking mode using the Set_Blocking_Mode API.

This function's prototype takes a pointer to the generic type sockaddr for its fromPtr parameter, for compatibility between IPv4 and IPv6 protocols.   The pointer to the sockaddr_in (IPv4) or sockaddr_in6 (IPv6, SC123/SC143 only! ) data structure which is actually used should be cast to a sockaddr type pointer to avoid compiler warnings, "Suspicious pointer conversion".

SC1x3 Comments

The actual library function reached here is named recvfrom_ipstackV2 .   The name change occurs due to a macro in the library header file.

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3
    V1.00V1.00V1.00V0.90

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document