Name

javax.microedition.io.DatagramConnection

Synopsis

This interface defines the methods that a datagram connection must have. A datagram connection can be established in a client mode or a server mode. For example, in a server mode (client initiates communication and server accepts connections), there is no need to specify the hostname: datagram://2233. And, in client mode, the hostname must be specified so that the client knows with whom to initiate communication: datagram://134.15.13.1:2233. Note that the port number in both modes is the same. In server mode, the same port number is used for both sending and receiving, and in client mode, the reply-to port is always dynamically allocated.

public interfaceDatagramConnection extends Connection {
   // public instance methods
   public int getMaximumLength(  ) throws IOException;
   public int getNominalLength(  ) throws IOException;
   public Datagram newData(byte[] buf, int size) throws IOException;
   public Datagram newData(byte[] buf, int size, String addr) throws IOException;
   public Datagram newDatagram(int size) throws IOException;
   public Datagram newDatagram(int size, String addr) throws IOException;
   public void receive(Datagram dgram) throws IOException;
   public void send(Datagram dgram) throws IOException;
}

Get Wireless Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.