Featured interfaces

javax.microedition.io.UDPDatagramConnection

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.

javax.microedition.io.Datagram

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.

Next topic: Featured classes
Previous topic: Overview

Was this information helpful? Send us your comments.