Do the MIDP APIs support server sockets or HTTP connections?

Xavier Palau

The MIDP 1.0 specification requires all compliant implementations to support the client portion of the HTTP 1.1 protocol. MIDP 1.0 does not require that any other particular protocol(s) be implemented.

Some device manufacturers, however, may choose to implement TCP sockets or other protocols. They may also choose (theoretically) to implement the server portions of those protocols.

You can check on a given device if it happens to support server sockets via the Generic Connection Framework (specified in CLDC and implemented by MIDP devices).

For instance, you might try using 'serversocket' as the protocol type in your Connector.open call, as:

        StreamConnectionNotifier notifier = null;
        String url = "serversocket://:" + appPort;

        try
        {
            notifier = (StreamConnectionNotifier) Connector.open (url);
        }
        catch (Exception e)
        {
            throw new IOException ("exception opening socket connection");
        }
        
        try
        {            
            sConnection = notifier.acceptAndOpen();
        }        
        catch (Exception e)
        {
            throw new IOException ("exception accepting socket connection");
        }

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact