Results 1 to 2 of 2

Hi I am quite new to bb. Currently I am using the the model 8100 ... BlackBerry Internet & Email forum

  1. #1
    cooldili's Avatar
    cooldili no está en línea Stack level 1
    Join Date
    Apr 2008

    Question HttpConnection faliure - Please Help!!!


    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 IOEXception: open tunnel max timeout.

    Please help me to overcome this issue. Have done lot of search but still couldn't find a solution. I will be very greatful a is anyone can help me in this.

  2. #2
    tony_ctc's Avatar
    tony_ctc no está en línea Stack level 2
    Join Date
    Jan 2008
    Well, it all depends what connection type you want to use...

    Here is the type of connections and how to connect:

    Direct TCP:
    HttpConnection http = (HttpConnection)";deviceside=true");

    HttpConnection http = (HttpConnection)";deviceside=false");

    The only thing I couldn't find yet is the BIS-B connection... But if you will connect via APN just use the Direct TCP connection...

    Hope it helps...

    ~via BB (

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts