BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 04-26-2008, 01:21 PM   #1 (permalink)
New Member
Join Date: Apr 2008
Model: 8100p
Carrier: none
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default HttpConnection faliure - Please Help!!!

Please Login to Remove!

I am quite new to bb. Currently I am using the the model 8100 pearl for testing the developed code.
In my application I need to establish HttpConnection or StreamConnection successfully. I need to give the parameters of APN settings in the code itself, without manually entering the APN settings in the phone. Therefore I have cleared all the APN settings in the phone.

I am using J2ME for development and I have written the following code segment.

HttpConnection connection = null;
InputStream stream = null;
StringBuffer b = new StringBuffer();

try {
connection = (HttpConnection)""+";WAPGatewayIP=<IP>"+";WapGatewayAPN=<APN>") ;
stream = connection.openInputStream();
boolean firstItr = true;
int test=0;
int ch;
while ((ch = != -1) {
b.append((char) ch);

test = ch;
firstItr = false;
Form form = new Form("Test");
Alert aleart = new Alert(null,"Connection successful \n"+test, null, AlertType.INFO);

System.out.println("connection closed");
} catch (IOException e) {
Alert aleart = new Alert(null,"Connection unsuccessful "+e.toString(), null, AlertType.ERROR);

That is the code i have written. Sometimes the connection establishment throws no exceptions but it doesnt give out any data. The method '' returns -1 always.

At some instances the connection does not establish successfully and throws an open tunnel IOEXception.

Please help me to overcome this issue. I will be very greatful a is anyone can help me in this.
Old 04-26-2008, 01:22 PM   #2 (permalink)
iPhone Convert
juwaack68's Avatar
Join Date: Oct 2005
Location: Tulip City - MI
Model: iP5
OS: 6.0.2
PIN: to beans
Carrier: I'm not
Posts: 13,875
Post Thanks: 3
Thanked 72 Times in 55 Posts

Moved to Developer Forum.
No longer a BES Admin, but it was fun while it lasted!
Old 04-26-2008, 11:37 PM   #3 (permalink)
New Member
Join Date: Apr 2008
Model: 8100p
Carrier: none
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts

I have done lot of internet search but still couldnt find a solution. Anyone who has come across this error please help.
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Copyright 2004-2014
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.