You basically want to write a server that listens to a certain port, and in each of your forked children, write an IO::Socket client which connects to that server. The server should probably also use IO::Select, which you can add a bunch of connections to, and deal with each one as and when it has data to be dealt with.
Eg: Assuming $sock1 and $sock2 are accepted client sockets on the server, and $server is the server socket:
(Should probably keep the client sockets in an array though, easier to add/delete that way..)my $sockets = IO::Select->new(); $sockets->add($server); $sockets->add($sock1); $sockets->add($sock2); while(1) { my @handles = $sockets->can_read(3); foreach my $handle (@handles) { if($handle == $server) { # Accept new client connection from server } elsif($handle == $sock1) { # Do something with info from $sock1 } elsif ... # etc etc. } # last when whenever.. }
Hope this makes any sense.. Post some code if you get stuck..
C.
In reply to Re: examples of IO::Socket::UNIX usage please?
by castaway
in thread examples of IO::Socket::UNIX usage please?
by agh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |