Re: [PHP] passing resources from one script to another

2004-11-11 Thread Ian Firla

Thanks Greg.

That is what I'm doing.

The problem remains passing a resource to the script executed by exec.

Ian

On Thu, 2004-11-11 at 08:45 -0600, Greg Donald wrote:
> On Thu, 11 Nov 2004 15:15:56 +0100, Ian Firla <[EMAIL PROTECTED]> wrote:
> > 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.
> 
> PHP doesn't have threads.. and that's what you would need to accept
> more than a single connection at once.  You can simulate thread
> functionality to a degree using the PHP execution functions here:
> 
> http://www.php.net/manual/en/ref.exec.php
> 
> 
> -- 
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> F

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] passing resources from one script to another

2004-11-11 Thread Ian Firla

I should have specified that this is a shell script, not a web
application.

I have a listening process running. The listening process calls another
script once a connection is established. This is done via exec.

It works; however, I can't pass a resource directly to the other script.
Therefore, I've passed the resource to "serialize()" and pass the
resulting string to the other script as an argument. My idea was to
"unserialize" the string in that script. I expected to get a resource
back; unfortunately, I get an integer.

My question is: is there any way to pass a Resource between scripts?

Ian

On Thu, 2004-11-11 at 15:36 +0100, Sebastiano Cascione wrote:
> I'm not shure to understand what you are looking for...
> 
> You can build a message queue into a text file, every message in the queue 
> will contain the pid as identifier of every socket connetion (the client) and 
> the target pid. 
> This is not a fast solution, but it models a messages system that is 
> indipendent from the server. For example, this queue colud be readed from the 
> client every time it launchs an avent, ect..
> 
> A question, why don't use session vars? (or an array of them?)
> 
> Sebastiano
> 
> 
> Alle 15:15, giovedì 11 novembre 2004, Ian Firla ha scritto:
> > 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] passing resources from one script to another

2004-11-11 Thread Greg Donald
On Thu, 11 Nov 2004 15:15:56 +0100, Ian Firla <[EMAIL PROTECTED]> wrote:
> 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.

PHP doesn't have threads.. and that's what you would need to accept
more than a single connection at once.  You can simulate thread
functionality to a degree using the PHP execution functions here:

http://www.php.net/manual/en/ref.exec.php


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] passing resources from one script to another

2004-11-11 Thread Ian Firla

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php