Send some data..my $t_socket = IO::Socket::INET->new( 'PeerAddr' => "localhost", 'PeerPort' => $T_PORT, 'Proto' => 'tcp') or die "Second: Can't create socket to Third($!)\n";
Then listen for a response...if($name eq $match) { print "Second found match: $name\n"; print "Second sending \"$name\" to Third\n"; print $t_socket "$match\n"; }
Do I need to do a $t_socket->accept if the connection has already been established?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; } } }
Can you tell what I am doing wrong in the above example (since it's not working)?
Thanks!
In reply to Re^2: Bidirectional use of a Socket
by scotchfx
in thread Bidirectional use of a Socket
by scotchfx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |