 |
sendto ..msdn Add comment W32 Constants Translate this page |
 |
 |
|
Sends data to a specific destination. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
int sendto(
SOCKET s,
const char* buf,
int len,
int flags,
const struct sockaddr* to,
int tolen
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER sendto IN ws2_32;
INTEGER s,;
STRING @buf,;
INTEGER buflen,;
INTEGER wsflags,;
STRING @sendto,;
INTEGER tolen
|
 |
 |
 |
| Parameters: |
 |
s
[in] Descriptor identifying a (possibly connected) socket.
buf
[in] Buffer containing the data to be transmitted.
len
[in] Length of the data in buf, in bytes.
flags
[in] Indicator specifying the way in which the call is made.
to
[in] Optional pointer to a sockaddr structure that contains the address of the target socket.
tolen
[in] Size of the address in to, in bytes. |
 |
 |
| Return value: |
 |
| If no error occurs, sendto returns the total number of bytes sent, which can be less than the number indicated by len. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError. |
 |
 |
| My comment: |
 |
The sendto function is normally used on a connectionless socket to send a datagram to a specific peer socket identified by the to parameter. Even if the connectionless socket has been previously connected to a specific address, the to parameter overrides the destination address for that particular datagram only.
On a connection-oriented socket, the to and tolen parameters are ignored, making sendto equivalent to send. |
 |
 |
| Word Index links for the sendto : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2006-06-12 16:22:38 | | Modified: | 2006-06-12 16:26:57 | Visited in last 7 days: 12 |