WEME 5.7.1 on Garnet v5.4.8 - HttpConnection limit? - Websphere
This is a discussion on WEME 5.7.1 on Garnet v5.4.8 - HttpConnection limit? - Websphere ; We have an MIDlet application that is displaying some peculiar behaviour. Each time the application runs it only makes eleven HttpConnections. That's it.
The application continues to work after the eleventh HttpConnection but does not successfully make any more HttpConnections. ...
-
WEME 5.7.1 on Garnet v5.4.8 - HttpConnection limit?
We have an MIDlet application that is displaying some peculiar behaviour. Each time the application runs it only makes eleven HttpConnections. That's it.
The application continues to work after the eleventh HttpConnection but does not successfully make any more HttpConnections. The user can navigate through various displays, enter values in text boxes, etc...
If the user shuts the application off and restarts it then the application makes eleven more HttpConnections. Always eleven, never ten or twelve.
There really isn't a lot more to tell about the problem. We've tested it against a couple of web servers all running the same version of apache. I'm hoping it's either a config on the device or a problem with 5.7.1 that is fixed by upgrading.
Versions:
JVM - WEME 5.7.1
Device - Garnet 5.4.8
Web Server - Apache 1.3.x
Any help or guidance is appreciated.
Regards
BTW - Don't use DataOutputStream.flush() on Palm against Apache 1.3.x with PHP installed. The flush() method causes the connection to use chunked encoding. Apache will respond with an HTTP 411 error.
-
Re: WEME 5.7.1 on Garnet v5.4.8 - HttpConnection limit?
I am including the code that fails. Code:
HttpConnection httpConnection = null;
DataInputStream dataInputStream = null;
DataOutputStream dataOutputStream = null;
InputStream inputStream = null;
try{
// reply stored here
StringBuffer messageBuffer = new StringBuffer();
// connect to this URL
httpConnection = (HttpConnection)Connector.open(GetDestinationURL() );
// use a POST
httpConnection.setRequestMethod(GetMethod());
// set content type
httpConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// set user agent
httpConnection.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.1");
// set content language
httpConnection.setRequestProperty("Content-Language", "en-CA");
// turn the output string into a byte array
byte postmsg[] = GetHttpConnectionString().getBytes();
// set the length of the outgoing message
httpConnection.setRequestProperty("Content-Length", "" + postmsg.length + "");
// open the output stream
dataOutputStream = httpConnection.openDataOutputStream();
// write the stream
for(int i=0;i
dataOutputStream.write(postmsg[i]);
}
// in case of problems - force the data out of the stream
try{
dataOutputStream.flush();
}
} catch (Exception e){
String tmpString = e.toString();
}
dataOutputStream.close();
// get the reply
dataInputStream = new DataInputStream(httpConnection.openInputStream());
... End code.
By inserting debugging statements I have found the program execution stops at "httpConnection.setRequestMethod(GetMethod());". This leads me to beleive that there is something wrong with the httpConnection since this is the first method to be invoked.
Remember - this code works fine the first eleven times it is run.
Any help / feedback / suggestions are appreciated.