Help - J2ME implementation in BlackBerry -> Http

F

fabius

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top