Keep TCP/IP connection alive for subsequent accesses
Posted: Wed Apr 05, 2006 10:29 pm
Hi gurus,
I has faced one problem for a week and I has not found out the solution. Can you help me to solve it?
My Web Server connects to another Server that is made by myself through TCP/IP sockets.
(Web Server(Apache, PHP)) <==TCP/IP==> (another Server)
If client requests a page:
1. Web Server creates connection with "another Server"
2. Get information from "another server"
3. Return the page to the client
At after step 3, the web server closes connection immediately. I want to keep the connection alive for subsequent pages. This is my problem. Do you know the reasons? Thank you very much.
The socket ID is saved in a class, the class is saved in $_SESSION array. But the class can not be shared among subsequent accesses. Maybe PHP can keep atomic data in $_SESSION array, but PHP can not keep complex objects in $_SESSION array?. It is why when, after the step 3, the server destroy complex objects, and the connection is destroyed too. Am I right?
I has faced one problem for a week and I has not found out the solution. Can you help me to solve it?
My Web Server connects to another Server that is made by myself through TCP/IP sockets.
(Web Server(Apache, PHP)) <==TCP/IP==> (another Server)
If client requests a page:
1. Web Server creates connection with "another Server"
2. Get information from "another server"
3. Return the page to the client
At after step 3, the web server closes connection immediately. I want to keep the connection alive for subsequent pages. This is my problem. Do you know the reasons? Thank you very much.
The socket ID is saved in a class, the class is saved in $_SESSION array. But the class can not be shared among subsequent accesses. Maybe PHP can keep atomic data in $_SESSION array, but PHP can not keep complex objects in $_SESSION array?. It is why when, after the step 3, the server destroy complex objects, and the connection is destroyed too. Am I right?