APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS














(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



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

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

Prapanna.





More Articles by prapanna




Click here to add your comments





Wed Mar 22 22:14:52 2006: Subject:   TonyLawrence

gravatar
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

gravatar
Good catch!

Thanks!

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



Auto FTP Manager

/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

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!



 I sell and support
 Kerio Mail server






More:
       - Forum


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress