Can I establish a TCP/IP socket connection from a J2ME MIDP application (MIDlet)?

Bill Day

The MIDP specification requires any sort of protocol or connection support to be implemented using the J2ME CLDC Generic Connection Framework. The MIDP spec specifically requires all implementations to support HTTP. This HTTP support may or may not be over TCP/IP; HTTP can optionally be implemented over any protocol stack such as the WAP stack or NTT DoCoMo's proprietary imode stack, so long as the implementation complies with the MIDP spec's requirements for HTTP client connections.

Because the MIDP specification does not require TCP/IP socket support, not all MIDP-based devices may provide sockets. If they do, however, the socket support must be available via the Generic Connection Framework's Connector.open() static method.

For more information on the Generic Connection Framework and on the MIDP implementation of HTTP using this framework, please refer to the related FAQ entries on CLDC Connector and MIDP HTTP connections.