For Programmers: Free Programming Magazines  


Home > Archive > Java Help > September 2004 > Help - J2ME implementation in BlackBerry -> http









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help - J2ME implementation in BlackBerry -> http
fabius

2004-09-25, 8:57 pm

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=167
3K,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=2
K,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=151
5K,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=46
K,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.
fabio
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com