Custom Search

Wednesday, July 2, 2008

Network MIDlet

MIDlet is application that develop using J2ME with Mobile Information Device Profile (MIDP). MIDP has a facility for build connection to external resource with GenericConnection Framework ( GCF ). it facility used for support client – server and datagram networking. MIDP implementation must support facility to access server and HTTP 1.1 protocol.

GCF providing HttpConnection interface for build all connection to network. Connector class and connection interface’s available in javax.microedition.io package. this decription about interface’s :




Connection : base connection that only can open and close.
ContentConnection : stream connection that provide accesed to web data.
DatagramConnection : datagram connection that useful for handle packet communication based.
InputConnection : input connection to a communication device.
OutputConnection : output connection to a communication device.

we must always use connector class to manage network connection. all method in connector class is static with the most important part is open() method. There are 3 version open() method :

  • static Connection open( String Name ) throws IOException
  • static Connection open ( String Name,int mode ) throws IOException
  • static Connection open ( String Name, int mode, Boolean timeout ) throws IOException

the first parameter is connection string. this use to select connection type that why this parameter is very important.

int mode use to description connection mode, READ, WRITE or READ_WRITE. default is READ_WRITE

example :

StreamConnection conn = (StreamConnection).Connector.Open (http://www.google.com)

No comments:

Free Traffic

 Join My Community at MyBloglog! Blog Flux Directory 

Web Developement Blogs - BlogCatalog Blog Directory web development blog  Internet Blogs - Blog Top Sites 

Blog Directory 

Click Here for Free Traffic!

Link2Communion.com