Page 1 of 1

Passing a resource-handle to another script

Posted: Sun Dec 19, 2004 2:39 am
by smilodon
Hi All,

I'm writing a small server consiting of two cli-scripts: The first one handles incoming connections, accepts them, and then passes the accepted connection to the second script, that then handles the rest.
This look something like this:

Script 1:
[...]
$ch = socket_accept($listen);

$ch should now be passed to the second script, but I couldn't pass it as command-line argument nor on STDIN..:(

I'm more or less desparately looking for help!
Thanks a lot and best regards,
smilodon

Posted: Sun Dec 19, 2004 5:00 pm
by dull1554
why do you have to do the processing between two different scrips?

if you incorperate both scripts this problem will be eliminated.....

yes but,

Posted: Sun Dec 19, 2004 5:11 pm
by smilodon
this wouldn't allow me to handle mor than one connection concurently

Posted: Sun Dec 19, 2004 5:14 pm
by dull1554
ahhh, never thought of that, im not exactly sure how but if im not mistake you can pass that connection through a session var

im assuming it would be something like:

Code: Select all

session_start();
$_SESSION['ch'] = socket_accept($listen);
then as long as you call session start at the begining of the script you should be able to access the connection.....

i think....

Posted: Sun Dec 19, 2004 5:24 pm
by smilodon
I think I should have been a bit more specific: I'm writing a 'real' Server, like a webserver and therefore I write cli-scripts.
I basically need to pass a resource to another program, and this seems to be impossible (but then, how do other servers handle this?)

best regards,
smilodon
^-- going to bed now 0:25 am