#!/usr/bin/perl use strict; use IO::Socket; my $sock = new IO::Socket::INET( PeerAddr => 'localhost', PeerPort => 6224, Proto => 'tcp', ); open(FILE,">file.exe"); binmode(FILE); while(<$sock>) { print FILE <$sock>; } close(FILE); close($sock); #### #!/usr/bin/perl use strict; use IO::Socket; my $sock = new IO::Socket::INET( LocalPort => 6224, Listen => 10, Proto => 'tcp', Reuse => 1, ); while(my $conn = $sock->accept()) { open(FILE,"macshift.exe"); binmode(FILE); print $conn ; close(FILE); }