Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.microedition.io
Interface MulticastConnection

All Superinterfaces:
  Connection, DatagramConnection, UDPDatagramConnection

    public interface MulticastConnection

extends UDPDatagramConnection

This interface defines the capabilities that a datagram connection must have.

Reminder: Since the CLDC Specification does not define any actual network protocol implementations, the syntax for datagram addressing is not defined in the CLDC Specification. Rather, syntax definition takes place at the level of Java ME profiles such as MIDP.

In the sample implementation that is provided as part of the CLDC reference implementation, the following addressing scheme is used:

The parameter string describing the target of a connection in the CLDC reference implementation takes the following form:

      {protocol}://[{host}]:[{port}]

A datagram connection can be opened in a "client" mode or "server" mode. If the "//{host}" part is missing then the connection is opened as a "server" (by "server", we mean that a client application initiates communication). When the "//{host}" part is specified, the connection is opened as a "client".

Examples:

A datagram connection for accepting datagrams
datagram://:1234

A datagram connection for sending to a server:
datagram://123.456.789.12:1234

Note that the port number in "server mode" (unspecified host name) is that of the receiving port. The port number in "client mode" (host name specified) is that of the target port. The reply-to port in both cases is never unspecified. In "server mode", the same port number is used for both receiving and sending. In "client mode", the reply-to port is always dynamically allocated.

Also note that the allocation of datagram objects is done in a more abstract way than in Java 2 Standard Edition (J2SE). Instead of providing a concrete `DatagramPacket` class, an abstract `Datagram` interface is provided. This is to allow a single platform to support several different datagram interfaces simultaneously. Datagram objects must be allocated by calling the `newDatagram` methods of the `DatagramConnection` object. The resulting object is defined using another interface type called `javax.microedition.io.Datagram`.

Since:
  Java Card 3.next

Method Summary
`String` | `getLocalAddress()` Gets the local address to which the socket is bound.
`int` | `getLocalPort()` Returns the local port to which this socket is bound.

Methods inherited from interface javax.microedition.io.DatagramConnection
`getMaximumLength, getNominalLength, newDatagram, newDatagram, newDatagram, newDatagram, receive, send`

Methods inherited from interface javax.microedition.io.Connection
`close`

Method Detail

### getLocalAddress

    String getLocalAddress()
                           throws IOException

  Gets the local address to which the socket is bound.

  The host address(IP number) that can be used to connect to this end of the socket connection from an external system. Since IP addresses may be dynamically assigned, a remote application will need to be robust in the face of IP number reasssignment.

  The local hostname (if available) can be accessed from `System.getProperty("microedition.hostname")`

  Specified by:
    `getLocalAddress` in interface `UDPDatagramConnection`
  Returns:
    the local address to which the socket is bound.
  Throws:
    `IOException` - if the connection was closed.
  See Also:
    `ServerSocketConnection`

### getLocalPort

    int getLocalPort()
                     throws IOException

  Returns the local port to which this socket is bound.

  Specified by:
    `getLocalPort` in interface `UDPDatagramConnection`
  Returns:
    the local port number to which this socket is connected.
  Throws:
    `IOException` - if the connection was closed.
  See Also:
    `ServerSocketConnection`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"