Posted by Jerry Stuckle on 09/09/05 21:36
_andrea.l wrote:
> I'd like to write a program that running all the time: just a simple
> program, but written in php.
> 1)How can i do that?
> 2) I'd like that this program listens on a port to recive a message: how can
> I do?
>
> thank you in advance.
> Andrea.
>
>
Andrea,
It's not too bad. Ewoud pointed you to the socket interface; it's as
simple as opening a socket, listening for a message, and once received,
close the socket. Loop around and do it again.
You might also want to listen for a 'special' message such as "SHUT DOWN
NOW" which tells the program to shut itself down gracefully. Otherwise
you would have to kill. Not that this *should* cause a problem - but
I'm always in favor of graceful shutdowns :-).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|