We are trying to do a HTTP Post call on a Nokia-40 series (Nokia 3300), for some strange reason at the client side (midlet side), is not receiving the data completely even though the server is sending it correctly. This client code works perfectly fine for all other manufactures and Nokia-60 series. I have added the client and server code


CLEINT CODE

Public void connect()
{
HttpConnection hc = null;
InputStream in = null;
String url = "http://61.95.202.160/TestServlet";
byte[] raw2=null;
byte[] data=null;
int var=0;
try
{
hc = (HttpConnection)Connector.open(url);
hc.setRequestMethod("POST");
in = hc.openInputStream();
int contentLength = (int)hc.getLength();
data = new byte[1024];
int length=0;
ByteArrayOutputStream output=new ByteArrayOutputStream();
while(length!=-1)
{
length=in.read(data);
output.write(data,0,length);
}
data =output.toByteArray();

in.close();
hc.close();
output.close();

string.setText("Total="+data.length);

}
catch (Exception e)
{
string.setText("ERROR="+e.getClass().getName());
}
}


SERVER CODE


public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException
{
try
{
byte[] data=FileUtil.loadByteArrayFromFile("BinaryFile");
System.out.println("Sending Data Length="+data.length);
res.setContentLength(data.length);
OutputStream outputStream;
outputStream = res.getOutputStream();
outputStream.write(data);
outputStream.flush();
}
catch(Exception e)
{
e.printStackTrace();
}
}