Versions Compared

Key

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

...

Warning

...

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

...

ON THIS PAGE

Table of Contents
indent20px

...

Important

Use this object to receive multicast packets and join a multicast group by calling the JoinMulticastGroup() method. 

This object both sends and receives UDP packets. Use roDatagramSocket if you need the player to communicate using protocols such as SSDP, which only allow a server to respond to the source of a received request. The JavaScript equivalent is Node.js Dgram API.

Received packets are delivered to the message port as roDatagramEvent objects.

ifUserData

SetUserData(user_data As Object)

Sets the user data that will be returned when events are raised.

GetUserData() As Object

Returns the user data that has previously been set via SetUserData(). It will return Invalid if no data has been set.

ifMessagePort

SetPort(port As roMessagePort)

Posts messages of type roDatagramEvent to the attached message port.

ifDatagramSocket

GetFailureReason() As String

Returns additional information if the BindToLocalPort or Sendto methods fail.

BindToLocalPort(port As Integer) As Boolean

Binds the socket to the specified local port. Use this method to receive packets sent to a specific port. Alternatively, if you want to receive replies to sent packets (and it doesn’t matter which local port is used), pass a port number of 0, and the player will select an unused port. This method returns True upon success and False upon failure

GetLocalPort() As Integer

Returns the local port to which the socket is bound. Use this method if you passed a port number of 0 to BindToLocalPort and need to determine which port the player has selected.

SendTo(destination_address As String, destination_port As Integer, packet As Object) As Integer

Sends a single UDP packet, which can be an roString or roByteArray, to the specified address and port. This method returns 0 upon success and a negative error code upon failure.

JoinMulticastGroup(address as String) as Boolean

Joins the multicast group for the specified address on all interfaces that are currently up. This method returns True upon success and False upon failure. In the event of failure, GetFailureReason() may provide additional information. To ensure that you are joined on all network interfaces, you should register for roNetworkHotplug events and call the JoinMulticastGroup() method in response to the arrival of new networks.

ifUserData

SetUserData(user_data As Object)

Sets the user data that will be returned when events are raised.

GetUserData() As Object

Returns the user data that has previously been set via SetUserData(). It will return Invalid if no data has been set.

ifMessagePort

SetPort(port As roMessagePort)

Posts messages of type roDatagramEvent to the attached message port.

ifIdentity

GetIdentity() As Integer

...

The ifIdentity interface has been deprecated. We recommend using the ifUserData interface instead.

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

ON THIS PAGE

Table of Contents
indent20px