sendto Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
sendto Function
C
int sendto(
    SOCKET s, 
    const char* buf, 
    int len, 
    int flags, 
    const struct sockaddr* to, 
    int tolen
);
Description

The sendto function is used to send outgoing data on a socket. The destination address is given by to and tolen. Both Datagram and stream sockets are supported.

Preconditions

socket function should be called.

Parameters
Parameters 
Description 
Socket descriptor returned from a previous call to socket. 
buf 
application data buffer containing data to transmit. 
len 
length of data in bytes. 
flags 
message flags. Currently this field is not supported. 
to 
Optional pointer to the the sockaddr structure containing the destination address. If NULL, the currently bound remote port and IP address are used as the destination. 
tolen 
length of the sockaddr structure. 
Returns

On success, sendto returns number of bytes sent. In case of error returns SOCKET_ERROR

Remarks

None.

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