Sun Java Solaris Communities My SDN Account Join SDN
 
FAQ

MMEmulator "Extra Protocols"

 
 


Question

Why can't I open a socket connection using the MMEmulator in the MMAPI RI?

Answer:

In the MIDP 1.0 spec the only mandatory connection protocol is HTTP. Version 1.0.x of the J2ME Wireless Toolkit is based on the MIDP 1.0 reference implementation, so it supports that protocol. It also implements additional optional protocols (including socket), however, mostly for demonstration purposes, and you can enable them by setting an "enable extra protocols" property. (The toolkit sets this property to true by default, hence the socket support in the default emulators.)

How do you set that property? Find the lib subdirectory of the MMEmulator device (in Micorosoft Windows the default installation directory is C:\Program Files\MMAPI-1.0\). In that directory, open the internal.config file, and set the property com.sun.midp.io.enable_extra_protocols to true. (Actually it's just a matter on uncommenting an existing line in the file.) Then restart the toolkit and you're all set to go.

Note that in MIDP 2.0 all of the common connection protocols have become part of the spec, so of course version 2.0 of the J2ME Wireless Toolkit supports them, and there is no need to set any property.

Resources

Mobile Media API (MMAPI):
http://java.sun.com/products/mmapi/

Acknowledgments

Thanks to Ariel Levin for answering this question on the KVM-INTEREST list

Note: If you have a question to which you need an answer, try the Mobility Forums. You can read through the existing topics or register for your free Sun Developer Network membership and post new messages or threads. For more information, go to the Why Register page.

Back To Top