Sockets

Sockets are the lowest level of network communication that most programmers encounter, although real enthusiasts might choose to delve into the murky details of transport and network layers -- and some even survive the experience! Because the socket API is so simple, widely known, and universally available, it is often used as the basis for distributed applications involving one or more clients talking to a single server, exchanging information using a very basic application-level protocol. In this situation, the use of a higher-level abstract such as RMI, CORBA, or one of the Java Enterprise products would not be justified. All this notwithstanding, CLDC does not require the provision of a socket interface to the network, and neither does MIDP. Part of the reason is that sockets are usually used in connection with Internet protocols such as TCP/IP, but many mobile devices do not have a direct connection to the Internet, and, therefore, the device’s host software almost certainly does not include a TCP/IP protocol stack. Making sockets part of MIDP would have required manufacturers to add this software to their devices (which has an associated cost) or necessitated its inclusion in the MIDP reference implementation, which is not economically possible on many platforms because of the memory requirements. Socket support is, however, under consideration for the next version of MIDP, which is being developed under the Java Community Process as JSR 118. You can obtain information ...

Get J2ME in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.