Motorola C550, C450, C370 IOException when it detects a time-out condition, URL Format

Page 33

6

Network API

 

 

- boolean timeout – An optional third parameter, protocol may throw an

 

 

IOException when it detects a time-out condition.

 

 

The time-out period for the TCP implementation on the Motorola C370, C450, and C550

 

 

series of handsets is 20 seconds on read operation and about 45 seconds on write

 

 

operation if the time-out flag is set to true. If the time-out flag is set to false, the time-out

 

 

time is indefinite. The lingering time for closing sockets is 0 second (if the socket closed

 

 

by the server the lingering time will be less than 100 ms). If a new socket is requested

 

 

within this time frame and the maximum number of sockets opened has been reached (5

 

 

sockets), then an IOException is thrown.

 

 

Applications requesting a network resource for any protocol must use one of the three

 

 

methods above. The URL is the distinguishing argument that determines the difference

 

 

between HTTP, etc. The following chart details the prefixes that should be used for the

 

 

supported protocols.

 

 

 

 

 

Protocol

 

URL Format

 

 

 

 

 

HTTP

 

http://

 

TCP Sockets

 

socket://

 

UDP Sockets

 

datagram://

 

 

 

 

HTTP

The HTTP implementation follows the MIDP 1.0 standard. The Connector.open() methods return a HttpConnection object that is then used to open streams for reading and writing. The following is a code example to show implementation of HTTP:

HttpConnection hc = (HttpConnection)Connector.open( “http://www.motorola.com”);

In this particular example, the standard port 80 is used, but this parameter can be specified as shown in the following example:

HttpConnection hc = (HttpConnection)Connector.open( “http://www.motorola.com:8080”);

The other static Connector methods work in the same manner, but they provide the application additional control in dealing with the properties of the connection. By default, HTTP 1.1 persistency is used to increase efficiency while requesting multiple pieces of data from the same server. In order to disable persistency, set the “Connection” property of the HTTP header to “close”.

33

Image 33
Contents Technical Manual Table of Contents Lcdui JAD Attributes Purpose IntroductionAudience DisclaimerReferences Definitions, Abbreviations, Acronyms Revision HistoryDate Name Reason Acronym DescriptionDocument Overview Introduction Java 2 Platform, Micro Edition J2ME J2ME IntroductionResources Available Motorola J2ME PlatformNetworking Description DisplayFile & RMS Java VMDeveloping and Packaging J2ME Applications Guide to Development in J2MEIntroduction to Development Page OTA Procedure InstallationDownloading Applications Program and Data space notes Java Application Installer/De-Installer Jaid Starting ApplicationsExiting Applications Error Checks Launching Web Session for Http DownloadDownloading MIDlets XML Screen Renderings BombMan is back, now on your Taichi series of handsets Taichi handset New Games MIDlet Lifecycle Application ManagementMIDlet Suite Installation MIDlet Suite De-installation DestroyApp MIDlet Suite UpdatingCaller Purpose MethodStartApp or the pauseApp Using startApp MIDlet Control of MIDlet State Transitions Java SystemPage Network Connections Network APIClass Descriptions URL Format IOException when it detects a time-out conditionTCP Sockets UDP SocketsImplementation Notes Network API Description LcduiLcdui Gaming API and Sound Functional DescriptionClass Hierarchy BackgroundMusic Class Using BackgroundMusicBackgroundMusic Methods Gaming API containing a sound APIGameScreen Fields GameScreen ClassPublic int getKeyStates GameScreen MethodsInformation, disabling key events can improve performance GameScreen Using GameScreenImageUtil Class ImageUtil FieldsImageUtil Methods RgbData Using ImageUtilPalleteImage Class PalleteImage ConstructorPalleteImage Methods Public void setTransparentIndexint index throws Using PalleteImagePlayField Class Using Static and Animated TilesUsing Sprites Defining View WindowsPlayField Constructor 2N+1 2N + Public void addSpriteSprite s throws PlayField MethodsPage Public boolean collidesWithAnyTileSprite s throws PlayField Using PlayFieldSoundEffect Class Using SoundEffectSprite Class SoundEffect MethodsAnimation Frames Sprite DrawingSprite Constructor Sprite Methods Page Public final void drawGraphics g throws Using Sprite FileFormatNotSupportedExceptionSprites Max Midi Extension Support Java Gaming Sound APIFileFormatNotSupportedException Constructors Java Gaming Sound APIVibe and Backlight API Vibe and BacklightCreating a Message OverviewPermissions Sending a MessageJAD Attributes JAD AttributesMandatory attributes for manifest files MIDlet-Name Class Description Record Management SystemCode Examples RecordStoreCaveats TipsPhonebook Access API Phonebook AccessSample of code to create object of PhoneBookRecord class Phonebook Access API PermissionsSimmemory Sample of code for calling of ‘getMaxEmailLength ’ method Sample of code for calling of ‘isPrimaryint speedNo’ method Sample of code for calling of ‘getNumberCategories’ method Sample of code for calling of ‘setCategoryView’ method Sample of code for calling of ‘getUsedRecords’ method Int index = ReceivedRecord.getRecord1 Intelligent Keypad Text Entry API ITAPKey Mapping for the C370, C450, and C550 Appendix a Key MappingCenter Select END Available Memory Appendix B Memory Management CalculationAppendix C Online FAQC370, C450, and C550 Spec Sheets Appendix D Spec SheetsMotorola Developer Information Tools DocumentationReferences Purchase Motorola Developer Information Tools Motorola, Inc
Related manuals
Manual 110 pages 1.04 Kb