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.
Received packets are delivered to the message port as roDatagramEvent objects.
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.
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.
SetPort(port As roMessagePort)
Posts messages of type roDatagramEvent to the attached message port.
GetIdentity() As Integer
The ifIdentity interface has been deprecated. We recommend using the ifUserData interface instead.