recvfrom Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
recvfrom Function
C
int recvfrom(
    SOCKET s, 
    char* buf, 
    int len, 
    int flags, 
    struct sockaddr* from, 
    int* fromlen
);
Description

The recvfrom() function is used to receive incoming data that has been queued for a socket. This function can be used with both datagram and stream type sockets. If the available data is too large to fit in the supplied application buffer buf, excess bytes are discarded in case of SOCK_DGRAM type sockets. For SOCK_STREAM types, the data is buffered internally so the application can retreive all data by multiple calls of recvfrom.

Preconditions

socket function should be called.

Parameters
Parameters 
Description 
Socket descriptor returned from a previous call to socket. 
buf 
application data receive buffer. 
len 
buffer length in bytes. 
flags 
message flags. Currently this is not supported. 
from 
pointer to the sockaddr structure that will be filled in with the destination address. 
fromlen 
size of buffer pointed by from. 
Returns

If recvfrom is successful, the number of bytes copied to application buffer buf is returned. A value of zero indicates no data available. A return value of SOCKET_ERROR (-1) indicates an error condition.

Remarks

None.

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.