CLIENT.pl #!/usr/bin/perl use strict; use IO::Socket; $file="file1.txt" #This is the file to be opened in server side my $sock = new IO::Socket::INET( PeerAddr => '192.168.100.30', PeerPort => 7880, Proto => 'tcp', ); print $sock "$file"; open(FILE,">file.txt"); binmode(FILE); while(<$sock>) { print FILE $_; print FILE <$sock>; } close(FILE); #### #!/usr/bin/perl use strict; use IO::Socket; my $file1; my $sock = new IO::Socket::INET( LocalAddr => '192.168.100.30', LocalPort => 6224, Listen => 10, Proto => 'tcp', Reuse => 1, ); while(my $conn = $sock->accept()) { $file1=$_;#This should collect the filename send by client right? open(FILE,"$file1"); binmode(FILE); my @file = ; close(FILE); foreach my $x (@file) { print $conn $x; } }