in reply to Communication between mltiple scripts(&&servers)

Hmm, am I missing something here, or have all the answers so far suggested pipes, which are all well and good for IPC work, but have two disadvantages: The first can be hacked around, but you don't want to do that, because sockets were invented to handle bidirectional communications, both between processes on the same machine ('Unix-domain' sockets. I have no idea if Windows has an equivalent...), and between processes running on different machines ('Internet-domain' sockets).

I wrote a tutorial about this sort of thing a while back, which includes a few caveats (<grouse>including one which no-one believes exists... If nothing else, the documentation tells you not to use buffered IO with select, so stop doing it, dammit</grouse> ahem). If your requirements are simpler, you can use the other tutorial

Run servers on the slave machines, and clients on the master machine (in case you didn't find that totally obvious...). If you can connect to the slaves from the outside world, you will need some sort of security - either block the port at your router or firewall, or just check the originating IP with a piece of code like:

# $sock is the socket: this will work if you aren't using IO::Socket: ($port, $iaddr) = sockaddr_in(getpeername($sock)); $peer_addr = inet_ntoa($iaddr); # String, numbers and dots notation # Or, if you're using IO::Socket $peer_addr = $sock->peerhost();
I think if you check the address against a list of allowed addresses, that'll do the trick; it's fairly hard to spoof a TCP connection these days :-)

Andrew.

Replies are listed 'Best First'.
RE: Re: Communication between mltiple scripts(&&servers)
by ahunter (Monk) on Oct 10, 2000 at 01:54 UTC
    Something odd happened there... Who ate my cookie?

    Hmm, I was editing that at www.perlmonks.org, where I have a cookie set, but it posted it at perlmonks.org, where I don't... Gah... Assuming this posts correctly, you'd better vote on this node to see that credit/shame gets to the right place...

    Andrew.