[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New user.

Sender: Scott Klement <klemscot@xxxxxxxxxxxx>

On Thu, 3 Jul 2003, Hatzenbeler, Tim wrote:
> I saw your mget routine, but noticed the incoming field was dimmed to 50, if
> I make that bigger (1000) or so, would the api's support it?

It supports any length.  It uses pointer math to fill in the values, so
there's no limit (aside from those imposed by the operating system for a
single memory allocation) to how many entries you can return.

> Or would I use the mirroring routines, that you created?

The point of FTPAPI was to make it easy to write your own programs that
use FTP, not to use my demo code.  :)   But, the TESTMIRxx examples do
show you how to get multiple files, as well as how to tell if the names
you receive are directories or files.   That's useful to understand for
your application.

> And whats the best way to make sure the file I received on my machine,
> is an exact duplicate of the file on the server?

FTP does not provide a facility to do that.   In theory, if the entire
file is received successfully you have an exact copy, so there shouldn't
be any need to compare them further, unless there's a bug in the client
or server somewhere...

If I had to implement some sort of verification system above that, what
I'd do is keep a file on the server of MD5 hashes for all files, and
download that... then calculate MD5 hashes on each file I download, and
make sure that it matches.   The CIPHER MI instruction is capable of
calculating MD5 hashes.

> Is there way to byte compare?

Well, I guess you could download the file twice and then read them both
byte by byte and compare them...   I'm not sure what that solves, though.

> And also, how do you move a file?  Is it the rename function?

FTP does not have a method of moving a file on the server itself (which
isn't that surprising, since FTP is for transferring files)  If the server
is an iSeries, you could do a remote command to move it.   If the server
is Unix, there's a chance that rename will work (since on most unix
systems rename and move are the same thing)

> And then delete?  I'm not very familiar with all the options of FTP
> other than put and get.

If you did a rename, you shouldn't need to delete.   If all else fails,
of course, you could transfer the file back to the server in the archive
directory, and then delete it from the original directory.   Not very
efficient, but FTP was designed for file transfer, not generic
manipulation of the remote filesystem.

> p.s.  This projects purpose, it to retrieve files from our as2 server.  All
> day long, trading partners send our as2 server invoices, and i'm looking for
> a way to retrieve these files, and then archive them, on the as2 server.

Should work... the only thing that seems difficult would be the
archiving, since FTP has no move capability.  Though, with a high speed
connection, simply transferring the file back to the server in the new
directory may do the job nicely.

This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr