Java Reference
In-Depth Information
socket://:79
socket://
In the first case, the system listens for incoming connections on port
79 (of the local host). In the latter case, the system allocates an available
port for the incoming connections.
ServerSocketConnection ssc = null;
InputStream is = null;
try {
ssc = (ServerSocketConnection)Connector.open("socket://:1234");
SocketConnection sc = (SocketConnection)ssc.acceptAndOpen();
...
is = sc.openInputStream();
...
} catch(IOException ioe) { ... }
The ServerSocketConnectioninterface extends the Stream-
ConnectionNotifier interface. To obtain a connection object for an
incoming connection the acceptAndOpen() method must be called
on the ServerSocketConnection instance. An inbound socket con-
nection results in the call to the acceptAndOpen() method, returning
a StreamConnection object which can be cast to a SocketConnec-
tion as desired.
A signed MIDlet suite containing MIDlets which open socket connec-
tions must explicitly request the appropriate permissions:
MIDlet-Permissions: javax.microedition.io.Connector.socket,
javax.microedition.io.Connector.serversocket, ...
If the protection domain to which the signed MIDlet suite would be
bound grants, or potentially grants, these permissions, then the MIDlet
suite is installed and the MIDlets it contains will be able to open
socket connections. This can be done either automatically or with user
permission, depending upon the security policy in effect on the device
for the protection domain to which the MIDlet suite has been bound.
Whether MIDlets in untrusted MIDlet suites can open socket connec-
tions depends on the security policy relating to the untrusted domain in
force on the device.
2.6.3 Secure Socket Support
Secure socket connections are client socket connections over SSL. To
open a secure socket connection we pass in a hostname (or IP address)
Search WWH ::




Custom Search