Motorola i88s manual Class Descriptions

Page 15

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

Image 15
Contents I88s Multi-Communication Device J2ME Developers’ Guide J2ME Networking Disclaimer Document OverviewContact Information Acronyms and DefinitionsAcronyms Used In This Guide Terminology Definition Overview Agps On The i88s PhonePosition API AccuracyAssist Data PositionConnection Class Almanac Out Of DateExample GetPositionString name Method DescriptionsRetrieving Position in Java GetPositionGetStatus Using Position in JavaExample Using PositionConnection Positionresponsenoalmanacoverride Addition, to obtain better accurate speed and direction Recommendation Http Https J2ME NetworkingClass Descriptions Http HttpsSupported Protocols on the i88s Phone TCP Sockets SSL Secure SocketsServerSockets UDP Sockets Serial Port AccessCommunicating on a Port Connection Optional ParametersImplementation Notes Example using StreamConnectionConcurrent Connections For The i88s Phone Protocol Maximum TipsFile I/O Class DescriptionMethod Descriptions Opening a file Deleting a file Reading and WritingCode Examples Example # 2 Complete MIDlet code Motorola Inc I88s J2ME Developers’ Guide Os = sc.openOutputStream //get InputStream Sc.close Caveats Motorola Inc I88s J2ME Developers’ Guide
Related manuals
Manual 43 pages 17.94 Kb