in reply to Re: Bidirectional use of a Socket
in thread Bidirectional use of a Socket
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Bidirectional use of a Socket
by pg (Canon) on Jul 04, 2005 at 00:51 UTC | |
by scotchfx (Sexton) on Jul 04, 2005 at 02:43 UTC | |
by pg (Canon) on Jul 04, 2005 at 05:52 UTC | |
by scotchfx (Sexton) on Jul 04, 2005 at 02:59 UTC | |
by scotchfx (Sexton) on Jul 04, 2005 at 03:04 UTC |