Motorola Inc.

i88s J2ME Developers’ Guide

the number of simultaneous connections that can be opened. The following chart characterizes the boundary conditions for each networking stack.

Table 2-3: Concurrent Connections For The i88s Phone

Protocol

Maximum

Notes

 

Concurrent

 

HTTP/

2

If the maximum number of HTTP Connections are

HTTPS

 

concurrently opened by the application and a third HTTP

 

 

Connection is requested, connections that have not been

 

 

active within the past 60 seconds are reclaimed and reused

 

 

if found, otherwise an exception is thrown to the calling

 

 

application.

Socket/

2

If the maximum number of sockets is concurrently opened

SecureSocket

 

by the application, and a third socket is requested, an

 

 

exception is thrown to the calling application.

ServerSocket

2

Only two ServerSocket is available. Any attempts to open

 

 

3 concurrent ServerSockets results in a thrown exception.

UDP

11

If a twelfth socket is requested, an exception is thrown to

 

 

the calling application.

Serial Port

1

Only one serial port is available. Any attempts to open 2

 

 

concurrent serial port connections results in a thrown

 

 

exception.

2.4Tips

A factor to take into consideration while developing networked applications is the blocking nature of many javax.microedition.io and java.io Object methods. It is advisable to spawn another thread specifically dedicated to retrieving data in order to keep the user interface interactive. If a single thread is used to retrieve data on a blocking call, the user interface becomes inactive with the end-user perceiving the application as “dead”.

Reading from an InputStream using an array is faster then reading byte by byte, when the length of the data is known. For example, if the content length is provided in the header of the HttpConnection, then an array of the specified size can be used to read the data.

The InputStream and OutputStream as well as the Connection Object need to be completely closed.

An application in the suspended state can still continue to actively use the networking facilities of the i88s phone.

The platform does not support simultaneous voice and data transmissions. The i88s phone will not be able to receive a phone call when exchanging packet data; however, it can receive a phone call on an idle open connection. An idle open connection means that a socket is opened but not transferring data. There is at least 10 seconds of linger time between switching from the data to voice, but switching from the voice to data is almost instantaneous. Therefore, a phone call may be received only after 10 or more seconds since packet data transmission.

Version 1.0 - Page 21

Page 21
Image 21
Motorola manual Tips, Concurrent Connections For The i88s Phone Protocol Maximum