Re: signal handling

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

 



Roman Neuhauser wrote:
> # manager@xxxxxxxxxx / 2006-12-02 02:01:35 +0200:
>> Hello
>>
>> Despite all of my results to succeed, i can not make this work. What i want
>> to do is to write a simple socket server in PHP. My current example just
>> prints the same character, you send to server from keyboard. It is
>> successfull in forking, and generates child as people connect. However in
>> any way the client exits, the child process remains defunct on system. I am
>> trying to use signal handling, but some comments say through hanging
>> sockets, it is not possible to handle signals.
>>
>> How can i stop this from happening, i am attaching the code i am working on,
>> the 2 signals added at the bottom are just for test there, i tried all other
>> signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process
>> when the client exits does not kill it too, it still is defunct.
>>
>> My code: http://pastey.net/2910
> 
>     The parent needs to wait(2) for its children. http://php.net/pcntl_wait

hi Roman,

have I understood correctly that using pcntl_wait() means you can't do anything in
the parent process until all children are dead?

this seems strange. probably I'm mis-understanding and need to reread [alot of] stuff.

but if it is true how do you go about tackling the signal handling in child processes
AND at the same time have the parent process do something useful like ...
interact/direct child processes, do other management tasks whilst child processes are running?

maybe I'm misunderstanding the whole concept - it's nice to have that newbie feeling again ;-)

> 

-- 
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