Alaska Software Inc. - ftp - directory or time/date retrieval?
Username: Password:
AuthorTopic: ftp - directory or time/date retrieval?
Johnftp - directory or time/date retrieval?
on Thu, 01 Aug 2002 14:05:24 -0400
I need to create a program to retrieve updated virus .dat files from the
McAfee ftp site.  They post updates randomly as new viruses are discovered
and we subscribe to their service to download these updates to a server on
our local network.

Recently McAfee notified us that they would no longer be offering automatic
downloads, but rather would post the updates on their ftp site and we would
have to download when we needed them.  The problem is that this is a manual
task - and it depends on us realizing we need the download and taking time
to go get it.  All this seems a simple enough task IF I can get the ftp
functionality I need.

Problem:
I need to compare the file on their ftp site with the one on my local
network.  If different, I want to automate the retrieval (get()) which is
easy enough.  But how do I determine whether their file is different from
the one I already have?

Is there any way to use ASINET to do the above?  Or am I at a dead-end as
far as using native xBase++ (ver 1.8) to do this?

John
James LoughnerRe: ftp - directory or time/date retrieval?
on Thu, 01 Aug 2002 14:50:25 -0400
You might want to check out my Xmanage software. With it you can schedule
downloads from an FTP site. ( the real purpose  is to manage adult
websites )

http://gogalthorp.com/xmanage


Jim

"John" <john@mcdermon.com> wrote in message
news:3d49777d@asgcom.alaska-software.com...
> I need to create a program to retrieve updated virus .dat files from the
> McAfee ftp site.  They post updates randomly as new viruses are discovered
> and we subscribe to their service to download these updates to a server on
> our local network.
>
> Recently McAfee notified us that they would no longer be offering
automatic
> downloads, but rather would post the updates on their ftp site and we
would
> have to download when we needed them.  The problem is that this is a
manual
> task - and it depends on us realizing we need the download and taking time
> to go get it.  All this seems a simple enough task IF I can get the ftp
> functionality I need.
>
> Problem:
> I need to compare the file on their ftp site with the one on my local
> network.  If different, I want to automate the retrieval (get()) which is
> easy enough.  But how do I determine whether their file is different from
> the one I already have?
>
> Is there any way to use ASINET to do the above?  Or am I at a dead-end as
> far as using native xBase++ (ver 1.8) to do this?
>
> John
>
>
>
phil@idep.org.uk Re: ftp - directory or time/date retrieval?
on Fri, 02 Aug 2002 09:54:37 +0000
>Problem:
>I need to compare the file on their ftp site with the one on my local
>network.  If different, I want to automate the retrieval (get()) which is
>easy enough.  But how do I determine whether their file is different from
>the one I already have?
>
>Is there any way to use ASINET to do the above?  Or am I at a dead-end as
>far as using native xBase++ (ver 1.8) to do this?

There is a way, but it is not straightforward, so you might want to
look at Jim's solution or a 3PP inet library like Marshallsoft, or
Shum's library.

To do it with ASINET, you need to be acquainted with the FTP
specification (RFC-959 - http://www.faqs.org/rfcs/rfc959.html).

First you need to open a socket connection on the correct port, and
establish a connection with the ftp server. Once you have negotiated
this, change to the correct ftp directory (if necessary) and issue a
LIST command, which should return a directory listing with all the
information you require.

Note that the format of the result of the LIST command is unspecified,
but will be consistent on the same server, so you may need to examine
the listing to determine how to extract the information you require.

Once you have determined that indeed the file is newer, you can use
the ASINET ftp class to download the file (unless you want to create
more work for yourself and code that as well).

I haven't really looked at the ASINET ftp agent, but I don't see why
you couldn't subclass it and add methods to switch directories,
retrieve LIST (and cast to an array?) yourself.

The easy solution is go for a 3PP product 

Regards,
Andreas Gehrs-Pahl Re: ftp - directory or time/date retrieval?
on Fri, 02 Aug 2002 13:43:17 +0200
Phil,

>First you need to open a socket connection on the correct port, and
>establish a connection with the ftp server. Once you have negotiated
>this, change to the correct ftp directory (if necessary) and issue a
>LIST command, which should return a directory listing with all the
>information you require.

If ASTAG would give us a simple SEND/RECEIVE option or command with the 
existing "FTPClient()" Class, or at least expose the Socket that is used, it 
would be much easier for us to do things like this.

>I haven't really looked at the ASINET ftp agent, but I don't see why you 
>couldn't subclass it and add methods to switch directories, retrieve LIST 
>(and cast to an array?) yourself.

Because the "FTPClient()" is completely encapsulated -- a black box design -- 
it is really not very useful. And for some strange (to me at least) reason, 
ASTAG has not ever even responded to any "FTPClient()" enhancement requests, 
with the exception of adding an option to switch to ASCII Transfer Mode.

I probably have to bite the sour apple and get the FCE4XB library from 
MarshallSoft, as I a) don't want to write an FTP Client from scratch (takes 
too long and is not worth the effort for me), and b) can't wait much longer 
until ASTAG decides to either implement those features or at least open up 
the FTP Class for us programmers.

I would love to get an explanation or comment from ASTAG though, why the 
ASINET "FTPClient()" class has been implemented in such a restrictive and
incomplete manner, that it is virtually useless in real-world applications.

-- Andreas

---                                                                       ---
  Andreas Gehrs-Pahl              E-Mail: GPahl@CharterMI.net
  415 Gute Street                     or: schnars@ais.org
  Owosso, MI 48867-4410               or: Andreas@Aerospace-History.net
  Tel: (989) 723-9927           Web Site: http://www.Aerospace-History.net
---                                                                       ---
Thomas BraunRe: ftp - directory or time/date retrieval?
on Fri, 02 Aug 2002 14:58:26 +0200
Hi John,

> Problem:
> I need to compare the file on their ftp site with the one on my local
> network. If different, I want to automate the retrieval

Get yourself FTPVoyager. 

It includes a scheduler that can synchronize complete 
directories via FTP.

> Is there any way to use ASINET to do the above?

If you have enough time, you could learn from the 
RFCs how FTP works and create your own FTPClient
class. But I think it's not worth the time
spent for such a simple task. FtpVoyager is not
very expensive (at least it is much more cheaper
than developing something on your own).

No need to re-invent the wheel over and over again 

Thomas Braun