Socket question!

P

Paul Oak

Hi all,

I would like to execute several HTTP POST requests to my localhost web
server (IIS 5.0) in a loop. Therefore I create a socket and using the
BufferedReader and Writer to write and read the reponse from the
server.
The problem is that after the first request the Web server closes the
socket.
Would you please help me to cope with this problem!
10x in advance!

Paul
 
G

Gorf

Paul Oak said:
Hi all,

I would like to execute several HTTP POST requests to my localhost web
server (IIS 5.0) in a loop. Therefore I create a socket and using the
BufferedReader and Writer to write and read the reponse from the
server.
The problem is that after the first request the Web server closes the
socket.
Would you please help me to cope with this problem!
10x in advance!

That's due to HTTP (1.0) being stateless, that is it closes the pipe after
each request. You may want to see if your server allows this in it's
config.

Something similar to:
<http://httpd.apache.org/docs/keepalive.html>
 
I

iksrazal

Hi all,

I would like to execute several HTTP POST requests to my localhost web
server (IIS 5.0) in a loop. Therefore I create a socket and using the
BufferedReader and Writer to write and read the reponse from the
server.
The problem is that after the first request the Web server closes the
socket.
Would you please help me to cope with this problem!
10x in advance!

Paul

Look at the jakarta commons HttpClient instead of doing your own
socket class. However, I'm thinking that since http is a stateless
protocol, you cannot keep a connection open for several invokations.
I'd be interested in finding out otherwise. Try searching on
httpclient or posting to the commons mailing list. If you find
something out, please post to this list.

HTH

Outsource to an American programmer living in brazil!
http://www.braziloutsource.com/
iksrazal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top