Help - J2ME implementation in BlackBerry -> Http

Discussion in 'Java' started by fabius, Sep 25, 2004.

  1. fabius

    fabius Guest

    Hi,

    I tested this code in BlackBerry Handeld:

    ======================
    httpCon = (HttpConnection)Connector.open(http://server:8080
    /sync4j/sync;WAPGatewayIP=x.x.x.x;WAPGatewayAPN=so
    mething;WAPGatewayPort=9201");

    httpCon.setRequestMethod(HttpConnection.POST);
    httpCon.setRequestProperty("content-length" ,
    String.valueOf(dataToSend.length) );
    httpCon.setRequestProperty ("content-type" ,
    "application/vnd.syncml+xml");

    System.out.println("debug ------------->>>>>> 2-content length:" +
    String.valueOf(dataToSend.length));

    outputStream = httpCon.openDataOutputStream();

    System.out.println("debug ------------->>>>>> 3");

    outputStream.write(dataToSend);

    System.out.println("debug ------------->>>>>> 4");

    inputStream = httpCon.openDataInputStream();

    System.out.println("debug ------------->>>>>> 5");

    int size = (int)httpCon.getLength();

    System.out.println("debug ------------->>>>>> 6");

    ====================================

    but if length of dataToSend byte array is larger then 1385 byte, code
    some
    time crashes at
    inputStream = httpCon.openDataInputStream(), and some time code works
    well.
    It's very strange..... (connection timeout?)
    However, if length of dataToSend byte array is less then 1385 byte,
    code
    works fine.

    This is the output of JDE debug attached 7230 handleld:

    =========================================

    CMM: SyncContact no sig from 0x33
    debug ------------->>>>>> 2-content length:1385
    debug ------------->>>>>> 3
    debug ------------->>>>>> 4
    VM:+GC(T)

    RX=174K,RF=284K,FF=6240K,HF=28322,OS=1673K,ON=16K
    ,OR=15,FR=556,HR=11,IS=1K
    RA=1010K,RS=393K,RN=4K
    TA=1449K,TS=1104K,TN=8K
    PA=176K,PS=176K,PN=2K
    R0=178K,2=7K,3=20K,7=5K,8=3K,9=410K,10=2K,12=46K, 13=7K,15=24K,16=308K
    VM:+PPO
    VM:pPOc=26,n=1601,s=1K,r=0
    VM:pPOt=12,g=5,p=7769
    VM:+RSF
    VM:-RSF
    VM:+RR
    VM:-RR
    VM:+CSF
    VM:CSF
    VM:CSF
    VM:CSF
    VM:CSF
    VM:CSF
    VM:-CSF

    RX=184K,RF=696K,FF=6330K,HF=28354,OS=1515K,ON=14K
    ,OR=0,FR=0,HR=0,IS=1K
    RA=598K,RS=0,RN=0
    TA=1360K,TS=1340K,TN=10K
    PA=175K,PS=175K,PN=1K
    R0=178K,2=7K,3=20K,7=5K,8=3K,10=2K,12=46K,13=6K,1 5=24K,16=308K
    VM:-GCt=1333,b=1,r=0,g=3,u=0,c=1
    VM:+CR
    VM:TI2R
    VM:-CR=3
    VM:+GC(F)
    VM:-GCt=54,b=1,r=0,g=1
    VM:+CR
    VM:TR2I
    VM:-CR=1

    ===========================================


    Later I change
    "outputStream.write(dataToSend);"

    in

    "for (int i = 0, l=dataToSend.length; i < l; i++) {
    outputStream.write(dataToSend<i>);
    outputStream.flush();
    }

    outputStream.close();
    outputStream = null;"

    but it works at the same way.

    I can't understand....
    Connection Buffer? Connection Timeout?

    Thanks & thanks & thanks....
    for any suggestion.
    fabius
     
    fabius, Sep 25, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Boldra
    Replies:
    0
    Views:
    1,331
    Boldra
    Dec 3, 2003
  2. John Goche
    Replies:
    4
    Views:
    3,938
    John Goche
    Feb 22, 2006
  3. John Goche
    Replies:
    0
    Views:
    1,914
    John Goche
    Feb 22, 2006
  4. Replies:
    0
    Views:
    1,108
  5. RdSchad
    Replies:
    2
    Views:
    1,522
    kalpesh2004
    Mar 21, 2011
Loading...

Share This Page