Motorola C450, C550, C370 technical manual TCP Sockets, UDP Sockets, Implementation Notes

Models: C450 C550 C370

1 86
Download 86 pages 61.66 Kb
Page 34
Image 34

TCP Sockets

The low-level socket used to implement the higher-level HTTP protocol is exposed to applications via the Generic Connection Framework. The usage is similar to the examples above, however, a StreamConnection is returned by the Connection.open() method, as shown in the following example:

StreamConnection sc =

(StreamConnection)Connector.open(

“socket://www.motorola.com:8000”);

Although similar to HTTP, notice the required port number at the end of the remote address. In the previous protocols, those ports are well known and registered so they are not required, but in the case of low level sockets, this value is not defined. The port number is a required parameter for this protocol stack.

UDP Sockets

If networking efficiency is of greater importance than reliability, datagrams (UDP) sockets are also available to the application in much the same manner as other networking protocols. The Connector object in this case returns a DatagramConnection object, as is shown in the following example:

DatagramConnection dc = (DatagramConnection)Connector.open( “datagram://170.169.168.167:8000”);

Much like low-level sockets, accessing UDP requires both a target address and a port number. The Motorola C370, C450, and C550 series of handsets supports a maximum outgoing and incoming payload of 1472 bytes and 2944 bytes, respectively.

Implementation Notes

As stated in the previous sections, the Motorola C370, C450, and C550 series of handsets supports some networking options. The networking options however are limited by both memory and bandwidth, which place hard restrictions on the applications. These limitations manifest themselves mainly in the number of simultaneous connections that can be opened.

Maximum number of sockets is 5 of any combinations of HTTP and UDP. Due to memory constraints, the C370, C450, and C550 can support only one secure session (i.e. if other application like Browser already opened a secure socket, a KJava midlet will get an IOException when it tries to open only one connection which is HTTP connection). If the maximum number of sockets is concurrently opened by the application and a sixth socket is requested, an exception is thrown to the calling application.

Page 34
Image 34
Motorola C450, C550, C370 technical manual TCP Sockets, UDP Sockets, Implementation Notes