Hi! I'm newbie here. Currently, I'm developing an applcation which involve the http connection. I need to stream images continuously from the server and my application will 'hang' after some time. I have tried many types of way to solve this issue but still unable to solve it. There's no http response back from the server if the AP signal strength is poor. I have used the setRequestProperty but it still unable to help me. Here are some of my code :

connection = (HttpConnection)Connector.open(myurl);
connection.setRequestProperty( "User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.1" );
connection.setRequestProperty("Cache-Control", "no-cache");
connection.setRequestProperty("Connection", "close");

int code = connection.getResponseCode();

if (code != HttpConnection.HTTP_OK)
{
}
else
{
byte img[];
int mylength = (int) connection.getLength();
if (mylength != -1)
{
img = new byte[length];
istream.readFully(img);
}

else
{
bstream = new ByteArrayOutputStream();
int chr;
while ((chr = istream.read()) != -1)
bstream.write(chr);
img = bstream.toByteArray();
bstream.close();
}

Is it something to do with the setRequestProperty method which caused no response back from the server? Is it 'connection.setRequestProperty("Connection", "close"); ' will close the http connection?


Please help!


Thanks!


Jac