Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in HTTP Connection in MOTOROLA

 
anshuman malviya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I really stuck up with one problem. I'm developing an application for MOTOROLA a388 PDA by using motorola SDK v-4. In that applicaton i connect to my server and fetch some data from ASP. when i run that application on emulator it works fine but when i port it on PDA it wont connect to the server and give error "CANT OBTAIL IP ADDRESS" or "PPP UP FAILED". If u could tell me the problem i'll be very very thankful to you. My email id is hello_anshuman@yahoo.com. Thanks The code which i write is as follows
private void retailor_status()
{
int i;
StringBuffer b = new StringBuffer();
String tmp_string;
HTTP_URL="http://203.200.89.104/SFA/J2ME/laststatus.asp?login=ME001&rcode=r001";
System.out.println(HTTP_URL);
try {
si1 = new String("");
myOutput.append(si1);
c = (HttpConnection)Connector.open(HTTP_URL);
c.setRequestMethod(HttpConnection.GET);
c.setRequestProperty("If-Modified-Since","29 Oct 1999 19:43:31 GMT");
c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-US");

InputStream is = c.openInputStream();
int len = (int)c.getLength();
c.close();
int ch = 0;
while ((ch = is.read()) != -1) {
b.append((char)ch);
System.out.print((char)ch);
}
is.close();
si1=b.toString();
String temp_char,temp_str="";
for(int x=0;x<si1.length();x++)
{
temp_char = si1.substring(x,x+1);
if(temp_char.equals("#"))
{
int y;
for(y=temp_str.length();y<30;y++)
temp_str=temp_str + " ";
myOutput.append(temp_str);
temp_str="";
temp_char="";
}
else
{
temp_str=temp_str + temp_char;
}
}
} catch (Exception ex) {
System.out.println("Exception reading from http"
+ ex.getMessage());
System.out.println("Exception reading from http" + ex.getMessage());
myOutput.append("ERROR IS "+ex.getMessage());
myOutput1.append("ERROR IS 1 "+ex.getMessage());
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic