Re: Exec Script in the background, don't wait till it finishes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 14, 2011, at 10:56 AM, Kai Renz wrote:

> Hi there,
> 
> i'm currently working on a socket project. It consists of two scripts.
> The first script (socket1.php) creates a socket on a specified port
> and waits for a client to connect. If a client connects, they exchange
> some informations, including a random created port. Next, the first
> script calls the second script (socket2.php) with the just created
> port number as a parameter.
> 
> Now here is the problem:
> it all works fine, but the client can't send a quit message to socket1
> because socket1.php waits until socket2.php is finished. socket2.php
> is working properly, and if i connect to the new socket and quit the
> connection, socket1 is working again. All i need socket1 to do is to
> continue working independant of socket2.
> 
> I tried everything, from shell_exec to pcntl_exec, nothing seems to work.
> 
> regards,
> Kai
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


To the best of my knowledge you are kind of in a hard place with that type of situation. 

I hate to be the guy that in the last three weeks mentions using a different language for an issue, but I honestly think that you may have a higher return using a language that supports threads a bit better. Hope this doesn't start another language battle.

Don't get me wrong, I love PHP, but there are certain things that a different tool may be easier to solve the problem with.


PHP or not: Could you describe the issue a bit more? What is the goal, at the end of the day?

Here is what I am gathering:

Open a socket 
client connects
get client to a different port to run independently


Can I assume that the goal of moving them to a different port is to be able to accept more clients on the first port?
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux