03-21-2012 01:27 PM
I have an interesting problem and I don't even know whether it is possible to do.
I would like to test the connection speed to a remote server and I'm thinking that the best way to do this is to FTP. If I upload and download a file using an FTP, can I capture the statistics as to how many bytes were transfered and how long it takes? Quick calculation would give me a general idea of the connection speed.
My reasons for this are that we are planning to FTP to a client files as part of a project and I would like to get some idea as to how long this process will take. There are a large number of files of different sizes. We currently have no idea whether the process will take 10 minutes or 10 hours.
I would like to do the FTP connection test with SAS because we will be using SAS to send and reveive the files in the future.
Thanks in advance.
03-21-2012 08:35 PM
If you have unix you could use lftp and dd
filename tmp temp;
filename tmp clear;
filename ftp_test pipe "lftp site -u user,pass -c 'cat /path/to/file.txt' | dd of=&tmp";
filename in "&tmp";
infile ftp_test firstobs=3;
input yada_yada $;
I beleieve the Filename statement for FTP access from SAS follows a similar pattern, ie. the file is read from FTP to disk as a temp file, then read from temp file into DATA step. I could be wrong about this, but if so this spends an extra I/O cycles doing so but will give you the speed at which the file is read from the FTP and written to local disk. You could also pipe the file from the FTP the same way and append the information from dd to the last three lines of the incoming file instead, just remove the of= part of the command in the pipe.
03-22-2012 09:01 AM
Thanks to everyone who took time to think about this.
Unfortunately, I am not running Unix so I can't use any processes native to that system.
Also - a PING will not tell me the time it takes to upload or download a file. I am already running a program that records the ping times.
From my experiments last night, here is what I came up with...
Firstly, I ran a PROC PRIINTTO to redirect the LOG file to a permanent dataset. Then I created a macro program that executes the FILENAME myfile FTP etc. (with the DEBUG option) and reads the file. The results from this are saved in the permanent log file.
I can then use a macro %do statement to run the program with a SLEEP(nn) between each iteration. I can sit back and let this program run for a while unattended.
Now I just need to write a little program to extract the data from the log file.