Chris wrote:
That's the design of http - it's stateless. Each connection is treated
separately and as such closes itself when it's finished.
If you want to keep it open you'll need to create your own "service"
that listens to a port and responds accordingly - which can be quite a
lot of work.
http://www.php.net/manual/en/ref.sockets.php
I can easily prove that HTTP can do it: Open a terminal or an SSH
connection to a unix machine, then type:
$ telnet <some web server> 80
GET / 1.1
Connection: Keep-Alive
<server resonds, keeps connection open>
GET / 1.1
Connection: Keep-Alive
<server responds, keeps connection open>
GET / 1.1
Connection: close
<server responds, closes connection>
Connections are capable of keeping themselves open for multiple requests
- that's what "Connection: close" and "Connection: Keep-Alive" headers
are for. For example http://webservices.codingtheweb.com/bin/qotd (with
WSDL http://webservices.codingtheweb.com/bin/qotd.wsdl). If you open a
connection to that with a soap client, you can make multiple requests to
it. Trace it with ethereal or something, and you'll notice there's only
one TCP connection setup (syn,syn/ack), followed by as many requests as
you want, and eventually one TCP teardown (fin/ack,ack) if you set up
the soap client to send a close request at some point.
The example script above may not be PHP (I don't have the code, as it's
not mine - just a random example), so for all I know PHP may not be
capable of such a thing. It may even be a limitation of the web server
(apache2) or the server's setup. (I just don't know, so that's why I'm
asking here.)
jon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php