my $t_socket = IO::Socket::INET->new( 'PeerAddr' => "localhost",
'PeerPort' => $T_PORT,
'Proto' => 'tcp')
or die "Second: Can't create socket to Third($!)\n";
####
if($name eq $match)
{
print "Second found match: $name\n";
print "Second sending \"$name\" to Third\n";
print $t_socket "$match\n";
}
####
while(my $third = $t_socket->accept)
{
print "Second has accepted socket to Third...\n";
my $t_host = gethostbyaddr($third->peeraddr, AF_INET);
my $t_port = $third->peerport;
while (<$third>)
{
my $name = $_;
chomp($name);
print "Received from [$f_host $f_port]: $name\n";
if($name eq $match)
{
print "Received \"$name\" from Third\n";
last;
}
else
{
last;
}
}
}