File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Availability of I/O connection interfaces for real implementation? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Availability of I/O connection interfaces for real implementation?" Watch "Availability of I/O connection interfaces for real implementation?" New topic
Author

Availability of I/O connection interfaces for real implementation?

Man Ip
Greenhorn

Joined: Jan 09, 2001
Posts: 4
When I read the MIDP documentation provided by Sun J2ME Wireless Toolkit, I found various connection interfaces in javax.microedition.io package including ContentConnection, DatagramConnection, HttpConnection, InputConnection, OutputConnection and StreamConnection.
Motorola J2ME SDK, however, only includes HttpConnection. I therefore think it may not be able to implement, if I use other types of connection in coding. Are those connections mentioned above platform-dependent? If it is the case, I doubt the availability of socket programming in J2ME, as mentioned in the related question by Rex Lee at Jan 12. Any comments and/or ideas?
Thanks.
--Man
Eric Giguere
Ranch Hand

Joined: Oct 25, 2000
Posts: 170
Those interfaces are defined by the CLDC. Profiles that provide any kind of network connectivity must use (or extend) one of those interfaces. MIDP only requires HTTP connectivity, so it's perfectly legal for an implementation to not support any other kind of connections, and hence never return any of the other interfaces.
Eric

[This message has been edited by Eric Giguere (edited January 17, 2001).]


Eric Giguere
Author/Co-Author of: Mobile Information Device Profile for Java 2 Micro Edition: Professional Developer's Guide, Java 2 Micro Edition: Professional Developer's Guide and PalmTM Database Programming: The Complete Developer's Guide
Man Ip
Greenhorn

Joined: Jan 09, 2001
Posts: 4
Thanks for your answer, Eric.
-- Man
Luis Valle
Greenhorn

Joined: Jan 08, 2001
Posts: 13
Hello,
In the CLDC specification 1.0, it has been defined the DatagramConnection interface with several methods, such us: getAddress, send, receive, newDatagram, etc. In the MIDP specification it is supported HTTP protocol for networking. But you can also use DatagramConnection for building a client/server application, can�t you?
In the Motorola J2ME SDK, there is an example called "UDP Tutorial", in which you can see the use of the UDP protocol for networking. And in the iDEN developer network site, you can see the sample code "MotoShop", which is a complete client/server application based in the DatagramConnection.
I am a little confused with these issues, because I can see in some documents about J2ME networking, that HTTP is the only supported protocol to build client/server applications.
You have two possibilities to build a client/server applications, one based on HTTP (HTTPConnection-MIDP), and other based on datagrams (DatagramConnection-CLDC), haven�t you?
Or am I wrong?
Thank you!
Best Regards, Luis �ngel.
Eric Giguere
Ranch Hand

Joined: Oct 25, 2000
Posts: 170
The MIDP spec says that HTTP is the only protocol that the device MUST support. Vendors are free to provide support for other protocols in addition to this, except of course that the Connection objects they return must extend one of the Connection interfaces defined in the CLDC. So Motorola can support UDP. This doesn't mean that every MIDP-enabled device will support UDP, though. HTTP is the only guarantee if you want portability between MIDP devices.
Eric
 
GeeCON Prague 2014
 
subject: Availability of I/O connection interfaces for real implementation?