Good day all.
I have nokia6280.
I tried to download a file of 50K from a remote site using HTTPGet (I succeeded downloading using other devices).
The file gets to my device - however, it seems that first the file gets to the device, and only then I can use the InputStream read method to get the data.
I tried setting content length of other size as an HTTP response header, and it seems that the device fetches the data according to the content length that is set - for content length of 100 bytes i wait less than content length of 1000 bytes.

On Java emulator and on Motorola device - it seems like the content-lengh field is ignored, and i can begin reading before the entire stream arrives to my device.


In order to avoid this implementation, I tried writing a code that accesses my device using the SocketConnection - since I know that for ports80, and 8080 I have to sign my midlet, I moved the device to listen to port 9999.
However, I only get information that the internet connection profile is "3G portal" and a progress bar, and I keep waiting and waiting and nothing....

Here is the socket code:

SocketConnection con = (SocketConnection)Connector.open("socket://mycompany.com:9999");
OutputStream os = con.openOutputStream();
String getText = "GET /logic/?page_id=2 HTTP/1.0\r\n" +
"Accept: image/gif,text/html,*/*" + "\r\n\r\n";
os.write(getText.getBytes());
os.flush();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is = con.openInputStream();

//Here I have a code that does the following task:
//reading the data from is and wrting to baos using by reading chunks of
//8K and writing them to baos

convertInputStreamToOutputStream(is,baos);

//Here I have code that places the length on a text box
writeOnTextBox(baos.toByteArray().length);

is.close();
os.close();


Is there any way to solve this? either the socket connection solution, or to tell the HttpConnection to start reading immediately and not wait for the entire file to be downloaded?