www.beck-ipc.com

@CHIP-RTOS C Library V2.00 - 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_in 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 options:
  MSG_BLOCKING - Sleep until data comes in
  MSG_TIMEOUT - The caller wakes up after timeout or if bufLen data comes in
  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 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
else 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.

See Also

RTOS API

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


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


End of document