Hej!
I have a strange problem with sending data (String) from midlet to servlet with HTTP POST. I cannot send more than about 1K of data because phone hung up on flush() method for some time then continue. At the same time servlet's doPost() doesn't obtain any data and throws exception after time out.
This problem doesn't appear when I use a S60 simulator and it doesn't appear when I send less than 1K of data from N6600.
a piece of code from the midlet:
conn = (HttpConnection) Connector.open(URL);
conn.setRequestMethod(HttpConnection.POST);
conn.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0"); conn.setRequestProperty("Content-Type", "text/html");
conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
conn.setRequestProperty("Connection", "close");
DataOutputStream os = conn.openDataOutputStream();
os.writeUTF(data);
os.flush();
os.close();
status = conn.getResponseCode();
httpResponse = conn.getResponseMessage();
Maybe there are some size limits of a message, or I should send data in a different form (bytes). Has anybody any suggestions ?
Ludwik Ejsmont

Reply With Quote

