passing resources from one script to another
| From: | Ian Firla | Date: | Thu, 11 Nov 2004 14:15:56 +0000 |
| Subject: | passing resources from one script to another | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-201765@lists.php.net to get a copy of this message | ||
Hi All,
I'm developing a small server application that accepts connections on a
socket and then launches an interactive session with the client.
The server needs to be able to accept N connections. This part is
working famously thanks to code I've borrowed and modified from:
http://www.zend.com/lists/php-dev/200205/msg00286.html
The problem is the dialogue with the client. If I enter into a while
loop then the whole script remains occupied and cannot accept new
connections.
If I try to open a new background process with exec, then I need to pass
a resource from the listening script to the dialogue script. However, it
seems that I cannot pass a resource between scripts.
If I serialize the resource, passing it as a string to the dialogue
shell script, then unserialize it in the dialogue script, it's no longer
a resource but an integer...
Any ideas on how to get around this problem? Can it be done with PHP?
Ian