in reply to UDP bidirectional client
test1.pl: use IO::Socket::INET; my $out = new IO::Socket::INET(Proto => "udp", PeerAddr => "localhost" +, PeerPort => 3000, Timeout => 10) || die "failed"; my $in = new IO::Socket::INET(Proto => "udp", LocalAddr => "localhost" +, LocalPort => 3001, Timeout => 10) || die "failed"; print $out "1\n"; while (1) { my $msg = <$in>; chomp $msg; print "got $msg\n"; print $out $msg + 1, "\n"; } test2.pl: use IO::Socket::INET; my $in = new IO::Socket::INET(Proto => "udp", LocalAddr => "localhost" +, LocalPort => 3000, Timeout => 10) || die "failed"; my $out = new IO::Socket::INET(Proto => "udp", PeerAddr => "localhost" +, PeerPort => 3001, Timeout => 10) || die "failed"; while (1) { my $msg = <$in>; chomp $msg; print "got $msg\n"; print $out $msg + 1, "\n"; sleep 1; }
test1.pl: use IO::Socket::INET; my $socket = new IO::Socket::INET(Proto => "udp", LocalAddr => "localhost", LocalPort => 3000, PeerAddr => "localhost", PeerPort => 3001, Timeout => 10) || die "failed"; while (1) { my $msg = <$socket>; chomp $msg; print "got $msg\n"; print $socket $msg + 1, "\n"; } test2.pl: use IO::Socket::INET; my $socket = new IO::Socket::INET(Proto => "udp", LocalAddr => "localhost", LocalPort => 3001, PeerAddr => "localhost", PeerPort => 3000, Timeout => 10) || die "failed"; print $socket "1\n"; while (1) { my $msg = <$socket>; chomp $msg; print "got $msg\n"; print $socket $msg + 1, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: UDP bidirectional client
by bronto (Priest) on Mar 06, 2003 at 17:03 UTC | |
by pg (Canon) on Mar 06, 2003 at 18:27 UTC | |
|
Re: Re: UDP bidirectional client
by sbrandt (Initiate) on Mar 06, 2003 at 18:44 UTC | |
by Thelonius (Priest) on Mar 06, 2003 at 21:12 UTC | |
by sbrandt (Initiate) on Mar 06, 2003 at 21:36 UTC | |
by Thelonius (Priest) on Mar 06, 2003 at 21:56 UTC | |
by sbrandt (Initiate) on Mar 07, 2003 at 13:41 UTC |