Motorola Inc. | i88s J2ME Developers’ Guide |
2.2Class Descriptions
| C o n n e ction |
S tre a m C o n n e c tio n N o tifie r | D a ta g ra m C on n e ctio n |
In p u tC o n n e c tio n | O u tp u tC o n n e ctio n |
S tre a m C o n n e ctio n
C o n te n tC o n ne c tio n
H ttp C o n n e c tio n
Figure 2-1: The Connection Framework
Since all the additional communication protocols have been added to the Generic Connection Framework, the access methods and parameters are very similar. The main calls are to the Connector class, which provides three static methods that accept different compile time parameters. The commonality between the three static methods is the first parameter in their signatures. This particular runtime parameter accepts Strings formatted in the standard Uniform Resource Locator format. The following is the list of method signatures:
Connector.open(String URL) – default READ_WRITE, no timeout
Connector.open(String URL, int mode) - defaults to no timeout
Connector.open(String URL, int mode, Boolean timeout)
String URL – parameter string describing the target conforms to the URL format as described in RFC 2396 for all networking protocols except for Serial Port.
int mode – READ/WRITE/READ_WRITE
boolean timeout - An optional third parameter, protocol may throw an IOException when it detects a timeout condition.
The timeout period for the TCP implementation on the i88s phone is 40 seconds on an open and about 120 seconds on read/write operations if the timeout flag is set to true. If the timeout flag is set to false, the timeout occurs in 180 seconds. The lingering time for closing sockets is 10 seconds, so if a new socket is requested within this time frame and the maximum number of sockets opened has been reached, then an IOException is thrown.
Version 1.0 - Page 15