#!/usr/bin/perl # use strict; use warnings; use IO::Socket; my $sock = new IO::Socket::INET ( PeerAddr => 'dan', PeerPort => '7070', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; print "What would you like to say: "; my $msg = ; print $sock "$msg\n"; close $sock; #### #!/usr/bin/perl # use strict; use warnings; use IO::Socket; my $sock = new IO::Socket::INET ( LocalHost => 'dan', LocalPort => '7070', Proto => 'tcp', Listen => 1, Reuse => 1, ); die "Could not create socket: $!\n" unless $sock; my $new_sock = $sock->accept(); while(<$new_sock>) { print $_; } close $sock;