my $self = shift;
my $filename = shift;
my $fh = new FileHandle ($filename);
if (not defined ($fh)) {
$self->message ("$filename: $!");
return 0;
}
my $filesize = (stat ($filename)) [7];
binmode ($fh);
$self->_w2 (START);
my $buf;
my $written = 0;
while ($filesize > 0) {
my $bufsiz = $fh->read ($buf, 512);
$self->_write ($buf, $bufsiz);
$filesize -= $bufsiz;
}
$self->_w2 (EOF);
$fh->close;
}
sub _w2 {
my $self = shift;
my $val = shift;
$self->_write (pack ("n", $val), 2);
}
sub _write {
my $self = shift;
my $bytes = shift;
my $nbytes = shift;
$sock->syswrite ($bytes, $nbytes);
}
Sending a file of 2G takes quite sometime to go through. If I want to compress it over the socket and send, how do i do it? i.e., i don't want to gzip,tar and send the tar.gz over the socket. Coz that will put the overhead of untarring(zipping) at the other end.
--Apaddobs.

New Topic/Question
Reply


MultiQuote










|