I have written a small program to receive the data from server in 1024 bytes every time on BB simulator, and find that the simulator will out of work after receiving a few minutes.The time is not the same, and the total data received is from 30M to 120M differently.
My code is as follow:
public void sockettest()
StringBuffer buffer = new StringBuffer();
int count = 0;
boolean RECE = true;
int LENGTH = 1024;
int n = 0;
int total = 0;
byte tempMemo = new byte[LENGTH];
int revc = 0;
SocketConnection sock = (SocketConnection)Connector.open(buffer.toString(),Connector.READ);
DataInputStream inStream = sock.openDataInputStream();
revc = 0;
//make sure to receive 1K every time
while(revc < tempMemo.length)
int coun = inStream.read(tempMemo,revc,(tempMemo.length-revc));
if( coun<0) break;
revc += coun;
total += revc;
System.out.println("The value of n is :" + (++n) + " "+total+" "+tempMemo.length);
The server is sending data continuing and the client is just need to receive the data continually.
So what's the problem of the client program? If you have good idea,please let me know! Or if you have good examples on receiveing large data, please show it to me !
Thank you very much!!