loss of data while ftp using NET::FTP in perl.



Author: prapanna
Date: Wed Mar 22 20:27:36 2006
Subject: loss of data while ftp using NET::FTP in perl.

I have a simple script which does login, cwd and get - for a tar.gz file. But if file size goes beyond some limit, the resulting file seems to loose a few 100 bytes.

E.g:
On FTP server: 12685981 Mar 22 11:50 test.tgz
File pulled using per: 12685778 Mar 22 12:02 test.tgz


Hate these ads?

Not sure where I am going wrong. I would appreciate if you could give some pointers. Thanks.

Prapanna.



Comments /Forum/prapanna1.html


Wed Mar 22 22:14:52 2006: Subject:   TonyLawrence
Did you set BINARY mode?



Thu Mar 23 18:58:09 2006: Subject:   prapanna
Yes. Here's the script:



#!/usr/bin/perl -w
use Net::FTP;
my $ftp = Net::FTP->new("ftp.mydomain.com") or die "\nINFO: Cann't connect";
$ftp->binary();
$ftp->login("myid","mypasswd") or die "\nINFO: Failed to login";
print "\nINFO: Login successful. Now getting...";
$ftp->cwd("mydir") or die "\nINFO: Couldn't change directory\n";
$ftp->get("test.tgz");
$ftp->quit;
print "\ndone\n";

I also tried it without binary. But the problem persists. BTW, the 'put' for the same tarball goes thru perfectly fine.

Thu Jun 8 15:52:06 2006: Subject:   anonymous
We saw the similar issue in our application. This was caused due to the link speed was reduced from 100mbps to 10mbps.



May be you would like to check on your link speed.

Wed Jun 21 22:47:00 2006: Subject:   anonymous
the problem is that you are calling the binary method before authenticating with the ftp server...so you are really using ascii



move the binary line below the login line and you should be fine


Wed Jun 21 23:03:27 2006: Subject:   TonyLawrence
Good catch!



Thanks!

Add your comments

LOD Communications, Inc.

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
1135617 3,927

/Forum/prapanna1.html copyright March 2006 prapanna All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

More:
       - Forum




Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://www.m3ipinc.com Security, firewalls, ids, audits, vulnerability assesments, BS7799, HIPAA, GLB, incident handling


larryi@ccamedical.com SCO OS5, Debian Linux, RedHat Linux, MySQL, Apache, AJAX development using dXport/dL4/Unibasic, Windows Connectivity, Sharing Resouces, Automation, Shell Scripting


http://www.cleverminds.net Need expert advice? Want a second opinion? CleverMinds is a one-stop-shop for a wide range of technology solutions. We support Unix, Linux, SCO as well as CMS, ecom, blogs, podcasts, search engines consulting and more. Contact us at web2.0@cleverminds.net 0r (617) 894-1282









Change Congress

Related Posts