#!/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);