Re: daemon without pcntl_fork

From: Date: Sat, 22 Aug 2009 08:59:35 +0000
Subject: Re: daemon without pcntl_fork
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-297072@lists.php.net to get a copy of this message
2009/8/20 Jim Lucas <lists@cmsws.com>: > 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 Sorry, missed that thread. > 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 In short, are you looking for a program which listens on a serial port and a network port at the same time, and places any data received from either into a database? Regards, Torben

« previous php.general (#297072) next »