Meaningless Drivel is fun!
The moose likes Java Micro Edition and the fly likes CLDC-HTTP communication.I am not getting any error ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "CLDC-HTTP communication.I am not getting any error ?" Watch "CLDC-HTTP communication.I am not getting any error ?" New topic

CLDC-HTTP communication.I am not getting any error ?

Joe Augustine

Joined: Apr 17, 2001
Posts: 9
Hi ,
I am developing a Palm App with J2ME and CLDC API's.
I made a sample application and tested in Kyocera Palm device and i am so thrilled to run it.
Now i want to make my application to communicate with a remote Oracle database.For this i am planning to make my Palm application to talk with Servlets in a webserver, so that i can send and recieve data extensively.
But i am not able to do the communication module successfully.
I tried out a sample code and it didn't throw any exception and the return values of every function said it is sucess.So i thought i did all !!!
And later i tried with a jung (invalid) URL and i got shocked to see the same result ..i mean no error.All the branches of the program returned success values.
What does it mean ??? So my application actually not contacting any URL. Otherwise it should throw some invalid URL exception.....right ?
But in both the cases the number of bytes returned by read function was 0 and none of the other connection function throwed any exception,
like connect(),OpenInputStream...etc.
This is my sample code.


StreamConnection m_Conn = null; //Connection

DataInputStream m_In = null; //Input Stream

String sURL = "";



StringBuffer sbInput = new StringBuffer("");

int iData;

int iCount = 0;

m_Conn = (StreamConnection),Connector.READ_WRITE,true);

m_In = m_Conn.openDataInputStream();

for(iCount = 0 ; (iData = > 0 ; iCount++)





MsgTxtBox.setText("Recd :"+sbInput.toString());



catch (RuntimeException e)





catch (Exception e)






If i understood anything wrongly pls correct me.And pls tell me what should i do....i am really in a trouble.
Pls let me know if u need any more info ,so that u can give me a better reply.
Hope to hear from u soon.
Thanks and Regards
Joe Augustine
Eric Giguere
Ranch Hand

Joined: Oct 25, 2000
Posts: 170
Haven't tried any of it on the Kyocera. Note that the "http:" protocol only works on Palm devices that support web clipping, and that you have to configure the device to use the Palm.Net gateway. The "testhttp:" protocol works as long as you've configured your device to use a PPP connection. I think the latter is more what you'd want. However, note that both protocols as implemented in the Palm CLDC are strictly experimental and have problems. I wouldn't try building any real apps with them, you should rather wait until Sun releases its MIDP implementation for the Palm, which will have proper HTTP support.

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
I agree. Here's the link:
subject: CLDC-HTTP communication.I am not getting any error ?
It's not a secret anymore!