public interface IMCConnection
extends javax.microedition.io.StreamConnection
This interface defines a low-level asynchronous bi-directional stream connection for the Inter-MIDlet Communication protocol (IMC), used for communication between applications.
An instance of this interface is returned from Connector.open()
when it is called with an IMC client URI string. An IMCConnection
instance is also returned from StreamConnectionNotifier.acceptAndOpen()
for incoming client connection.
An IMC server application can register a server connection with push registry and
be automatically launched upon client connection request. An implementation
MUST support registration of IMC server applications for application launch on
incoming IMC connection. If the AMS fails to launch the IMC server application due
to the system limit of maximum number of concurrent applications has been reached
or any other reasons, a
ConnectionNotFoundException
MUST be thrown from
Connector.open()
to the IMC client application.
The same exception will be thrown if the javax.microedition.io
package, being optional for MEEP 8, is not implemented and somebody tries
to place a call to Connector.open()
with an IMC argument.
The IMC client connection URIs must conform to the BNF syntax defined below.
If a client URI passed into Connector.open() does not conform to this syntax,
an IllegalArgumentException
is thrown.
<client_conn_string> | ::= "imc://" (<Application UID> | "*") ":" <server name> ":" <server version> ";" |
<Application UID> | ::= <Application suite vendor>":" <Application suite name>":" <Application suite version> |
<Application suite vendor> | ::= Application suite vendor |
<Application suite name> | ::= Application suite name |
<Application suite version> | ::= Formatted application suite version or wildcard character "*" |
<server name> | ::= IMC server name following the class naming syntax |
<server version> | ::= version of the IMC server. Version backward compatibility is
assumed.Versioning follows the format defined for the MIDlet-Version
attribute. |
The BNF syntax allows the wildcard "*" to be used instead of a specific Application UID when opening an IMC client connection. When the wildcard character is used, it allows the client to connect to any of the applications from different vendors if they all provide the same IMC service and meet the authorization requirements. However, which application's IMC server the client will be connected is implementation specific.
// Create a connection to any application providing the com.foo.services.barServer IMCConnection conn; try { conn = (IMCConnection)Connector.open( "imc://*:com.foo.services.barServer:1.0;"); } catch(ConnectionNotFoundException e) { ... } try { DataOutputStream request = conn.openDataOutputStream(); // writes request data ... // flush the request input stream request.flush(); DataInputStream response = conn.openDataInputStream(); // retrieve response data ... } finally { conn.close(); } |
Modifier and Type | Method and Description |
---|---|
MIDletIdentity |
getRemoteIdentity()
Get the identity of the application on the remote end of this connection
|
java.lang.String |
getRequestedServerVersion()
Get the server version the IMC client requested to connect to in the
client connection URI
|
java.lang.String |
getServerName()
Get the name of the IMC server of this connection.
|
openDataInputStream, openInputStream
java.lang.String getServerName()
java.lang.String getRequestedServerVersion()
MIDletIdentity getRemoteIdentity()
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.