Treehunter has asked for the wisdom of the Perl Monks concerning the following question:
Server:#!/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);
At this point, both connect and seem to transfer the file, the file is the same size and everything. If you try to run the program you get an error saying couldn't load the program into memory so I assume something is going wrong with my use of binmode. Please enlighten me Perl monks ;-)#!/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 <FILE>; close(FILE); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl IO::Socket Transfer A File Help
by BrowserUk (Patriarch) on May 05, 2007 at 17:43 UTC | |
by Treehunter (Beadle) on May 05, 2007 at 17:48 UTC | |
by BrowserUk (Patriarch) on May 05, 2007 at 19:07 UTC | |
|
Re: Perl IO::Socket Transfer A File Help
by Fletch (Bishop) on May 06, 2007 at 01:49 UTC |