use IO::Socket; my $sock = new IO::Socket::INET ( LocalHost => 'qnxa227', LocalPort => '7070', Proto => 'tcp', Listen => 1, Reuse => 1 ); die "Could not creat socket: $!\n" unless $sock; $sock->autoflush(1); print "The server is up and ready\n"; my $new_sock =$sock ->accept() || die " error $new_sock"; #### This just goes around an infinite loop gathering info while(1){ sleep(2); if( $ARGV[0] eq "l"){ & short; print "\n"; & long; } elsif( $ARGV[0] eq "lp"){ & short; print "\n"; & pfilter; } else { @x = (& short( $new_sock)); print($new_sock $x[0]),"\n"; print($new_sock $x[1]),"\n"; print($new_sock $x[2]),"\n"; } } close($sock); #### use IO::Socket::INET; $file = "info.txt"; #open(stdout,">>$file"); ### one way of trying to output to a file $sock = IO::Socket::INET->new( PeerAddr => '10.8.74.227', PeerPort => '7070', Proto => 'tcp'); print "client running\n"; my $byte; while (sysread($sock, $byte, 1) == 1) { print $byte; } close($sock);