This interface defines a datagram connection with a local endpoint address. Because UDP can be an unreliable protocol, delivery and duplicate protection are not guaranteed. To create this connection object, you must use the Connector.open() method with a URL parameter containing the protocol datagram://.
This interface also provides methods for accessing the local address and local port of the connection, and inherits methods from the DatagramConnection class to create, send, and receive Datagram objects.
The sample application uses this interface to create, send, and receive the Datagram objects.
This interface defines a generic Datagram object that acts as a holder of data that the application sends or receives.
This interface extends the DataInput and DataOutput interfaces to provide a simple way to read and write binary data in and out of the Datagram object's buffer.
In addition to the methods that the the DataInput and DataOutput interfaces provide, this interface also provides methods to access and set the address of the Datagram and to access and set the data in the Datagram object's buffer, the length of the Datagram object's buffer, and the offset of the cursor of the Datagram object's buffer.
This sample application creates an outgoing Datagram object, outDatagram, after the user has typed the message to send to the server-side application and clicked the Send key or menu item. The buffer that is passed into outDatagram is created with a length, in bytes, equal to the length of the String that you want to send to the server-side application.
The sample application creates an incoming Datagram object, inDatagram, with a buffer that is 8 bytes in length to store the string RECEIVED. This string is sent back from the server-side application when the server-side application receives outDatagram.
This is a factory class that provides methods that you can use to create a variety of different connection objects. This class uses the URL that you pass in as a String parameter to its open() method to dynamically create the correct connection object. The open() method extracts the protocol from the URL and looks up the platform name from a system property. Using these two pieces of information, the open() method returns the correct connection object.
UDPDatagramConnection _conn = (UDPDatagramConnection)Connector.open("datagram://127.0.0.1:2000;3000");