Re: File and socket handles

From: Date: Sat, 02 Dec 2000 19:08:10 +0000
Subject: Re: File and socket handles
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28378@lists.php.net to get a copy of this message
On Sat, 2 Dec 2000, Robin Gilks wrote: > Greetings all > > I've scanned the list archives but not found anything that relates to my > problem with socket handles. > > I want to open a socket connection from one frame (script) and transmit data > to the user from that socket - no problem there, all working fine using > either fsockopen or pfsockopen. > > I also want to use the same connection for data from the user to the socket > from another frame and I can't find a way of passing the socket handle to the > script that handles that part of the transaction. > > I've tried hidden fields and passing it via a database but each time I get > "Warning: Supplied argument is not a valid File-Handle resource in > /blah.php on line xxx" > > Looking at the variable I pass about I have the value "Resource id #1" > which I understand means the variable is entirely internal to php and can't > be represented outside of the interpreter and hence convey its value. > > All I wanna do it > $handle = fsockopen(host,port); > in one script and use > fputs($handle,$data) > in another one with some means of passing "$handle" > > So how the heck do I pass it around - there must be a way!! > You can't. The socket (and in fact, any PHP resource except a persistent DB connection) is closed once the first script stops running. -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#28378) next »