Re: daemon without pcntl_fork
| From: | Jim Lucas | Date: | Thu, 20 Aug 2009 15:18:49 +0000 |
| Subject: | Re: daemon without pcntl_fork | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297033@lists.php.net to get a copy of this message | ||
Lars Torben Wilson wrote:
> 2009/8/19 Per Jessen <per@computer.org>:
>> Jim Lucas wrote:
>
> [snip]
>
>> I probably wouldn't have chosen PHP for the first one, but there's no
>> reason it shouldn't work. For the second one, did you mean to
>> write "serial port"? That's a bit of a different animal, I'm not sure
>> how far you'll get with php.
>>
>>> Here is what I have come up with so far. Looks to satisfying my
>>> needs:
>>>
>>> tms_daemon
>> [snip]
>>> # END OF SCRIPT
>> Looks good to me. It'll certainly do the job.
>>
>>
>> /Per
>
> I agree with Per on all points--I probably wouldn't choose PHP as a
> first choice for the first task, but the startup script you have shown
> looks like a bog-standard startup script and should serve you well. I
> haven't really gone over it with a fine-toothed comb though. Typos
> etc. are still up to to you. :) Of course, the whole thing depends on
> how tms_daemon behaves, but the startup script looks OK.
>
> Can you explain in a bit more detail exactly what the second part (the
> serial-network data logger) needs to do? I've written similar daemons
> in C but not PHP--when I've needed to get something like that going
> with a PHP script, I've used ser2net (which I linked to in an earlier
> post) and been quite happy. Maybe you don't even have to do the hard
> work yourself (or buy extra hardware to do it for you).
>
>
> Cheers,
>
> Torben
>
As for the second project, I asked about it in the previous thread about
the SMDR/CDR processor.
http://www.nabble.com/SMDR-CDR-daemon-processor-td25014822.html
Basically, I need to have a process that collects data via serial
(USB|RS323), connects to a remote port, or listens and receives data
from the PBX pushing it.
The most common is the RS232 serial connection. Thats why I need to be
able to listen on the local RS232 port for data coming from the PBX system.
What I have built so far can connect to a remote machine, via a TCP/IP
connection, and wait for data to be push out the specified TCP port.
I haven't done it yet, but I know that I can easily build, using a
different project as a base, the version that would connect to a local
TCP/IP IP:PORT and wait for a PBX to send the data to that IP:PORT.
After the data has been received, the process flow will be the same with
all three methods. Parse it, sanitize it, store it.
Hopefully that explains a little more.
Jim