Internet Direct (Indy) Version 9.0.1 Beta
TIdSocketHandle.SendTo
Sends data to a specific address.

procedure SendTo(const AIP: string; const APort: Integer; var ABuffer; const ABufferSize: Integer);
Parameters
const AIP: string
IP address of the remote system.

const APort: Integer
Port number of the remote system.

var ABuffer
Buffer to send over the socket connection.

const ABufferSize: Integer
Size of the send buffer.

Description
SendTo is a procedure used to write outgoing data to a socket connected to the remote system specified in IP address and Port number.

SendTo will raise an EIdException exception if the number of bytes sent does not match the value in ABufferSize, or if the number of bytes sent is Id_SOCKET_ERROR.

SendTo is used on datagram or stream sockets. For datagram sockets, care must be taken not to exceed the maximum packet size of the protocol stack declared in MAXUDPDG. Streaming sockets will attempt to write all data in the buffer to the socket connection.

To send a broadcast datagram, the IP address parameter must contain Id_INADDR_ANY.