UDPSocketSend

Sends a UDP datagram to a remote device via an opened UDP Socket.

Syntax

UDPSocketSend( BytesSent, SocketID, IPAddr, Port, Payload, PayLoadLen)

Remarks

Sends a UDP datagram to a remote device via an opened UDP Socket. (It will be sent with the source port of that socket.)

Parameters

BytesSent

Returns the number of bytes written. If negative, an error occurred. The values that can be returned are:

Code Description
>=0 Successful send a datagram with a payload of this many bytes. (It is possible to send a UDP datagram of 0 bytes that will just include the UDP header.)
-1 Failed to send. (Network interface may be down.)
-2 Socket not initialized or was closed. (The only way this will be closed is if you call UDPSocketClose.)
-3  Invalid IP address.
-4 Invalid PayloadLen.
-5 Failed to allocate send buffer.

-6

Invalid SocketID.

Type: Variable of type Long

SocketID

Socket ID returned from a call to UDPSocketOpen().

Type: Constant or Variable of type Long

IPAddr

The IP address of the device to send this datagram to.

Type: Constant or Variable of type String

Port

The port to send this datagram to.

Type: Constant or Variable of type Long

Payload

The contents of the packet.

PayloadLen

The length of the payload in bytes. If payload length is 0, a zero-length UDP packet is sent.

Type: Constant or Variable of type Long