Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Oct 1998 09:03:13 -0800
From:      Graeme Tait <graeme@echidna.com>
To:        Peihan Wang <peihanw@mx.cei.gov.cn>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: size command under ftp
Message-ID:  <3634AB51.1333@echidna.com>
References:  <36346432.2DE86605@mx.cei.gov.cn>

next in thread | previous in thread | raw e-mail | index | archive | help
Peihan Wang wrote:
> 
> I am running an ftp server under FreeBSD 2.2.6.
> When I do the following there is something strange.
> 
> $ ftp localhost
> ... (omit login process)
> ftp> cd pub
> ftp> ls
> total 656
> -rw-r--r--  1 root  operator  321381 Sep  5 04:05 mc-4.1.31.tgz
> ftp> size mc-4.1.31.tgz
> mc-4.1.31.tgz   322545
> ftp> quit
> $
> 
> Why does 'ls' says the file size is 321381 while 'size' indicates
> that the file is 322545 bytes long ???


A slight clarification to my previous post. I said:

"By default, ftp is in ascii mode"

That should say, "by default the FTP server (ftpd here) is in ascii mode".

When you start ftp, it says "Using binary mode to transfer files" (in the 
login process you omitted). That is true, but the client does not set the 
server transfer TYPE until you actually transfer a file. If you immediately 
do a "size" command after logging on, or if you do a "size" command after a 
command like "ls" that sets ascii mode, you will get the result you found. 
You might say that the client is cheating on you, by using binary mode as 
the default for transfers, but not setting binary mode for the "size" 
command.


-- 
Graeme Tait - Echidna

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3634AB51.1333>