• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP connection

 
Ould Nadif
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,
I would like send several HTTP request/response without have to open a new connection.
//open connection ....open(url)
//send a first HTTP message
//receive inputstream
//send a second HTTP message
//receive inputstream
.
.
.etc.
I couldn't do it so far.
OULD NADIF
 
Christian Wolf
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like send several HTTP request/response without have to open a new connection.
The feature you want to use is called Keep-Alive. There are some problems with it that might prevent you of using this HTTP header. It seems to me that HttpConnection on MIDP offers only HTTP/1.0. The older protocol has some problems with Kee-Alive when connecting to proxies. And a proxy might be in place in your network.
Also, the API itself makes it difficult for you to flexible make use of Keep-Alive (if supported at all) as you specify the target URL in the initial (HttpConnection)Connector.open command. So I could only imagine that you can send multiple requests to the same URL again. You will recognize support or not very easy. When trying to send this header, you might get an exception "no resource". This indicates that this header is not supported, so you have to use single connections for each request.
Keep-Alive
Christian Wolf
 
Ould Nadif
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thank you for your reply.
In this case I have to manage Session ID every new connexion.
I am studing the question.
See you soon
OULD
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic