Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel
borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

ON THIS PAGE

Table of Contents
indent20px

This object allows UDP packets to be sent to a specified network destination. The JavaScript equivalent is Node.js Dgram API.

Object Creation: The roDatagramSender object is created with no parameters.

Code Block
CreateObject("roDatagramSender")

ifDatagramSender 

SetDestination(destination_address As String, destination_port As Integer) As Boolean

Specifies the destination IP address in dotted quad form along with the destination port. This function returns True if successful.

Send(packet As Object) As Integer

Sends the specified data packet as a datagram. The packet may be a string or an roByteArray. This method returns 0 upon success and a negative error code upon failure.

This example script broadcasts a single UDP packet containing "HELLO" to anyone on the network listening on port 21075:

Code Block
sender = CreateObject("roDatagramSender")
sender.SetDestination("255.255.255.255", 21075)
sender.Send("Hello")
Panel
borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

ON THIS PAGE

Table of Contents
indent20px