comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: FTP downloading in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: FTP downloading in IDL [message #80923] Mon, 23 July 2012 09:46 Go to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 7/23/12 8:58 AM, C.E. Ordonez wrote:
> On 7/21/12 3:50 PM, JBT wrote:
>> Dear all,
>>
>> So, does anyone know a working solution to download a file from an FTP
>> server, please? Your help is much appreciated!
>>
>
> Both socket and IDLnetUrl methods worked on my OS X Lion + IDL 8.2:
>
> IDL> help,!version,/st
> ** Structure !VERSION, 8 tags, length=104, data length=100:
> ARCH STRING 'x86_64'
> OS STRING 'darwin'
> OS_FAMILY STRING 'unix'
> OS_NAME STRING 'Mac OS X'
> RELEASE STRING '8.2'
> BUILD_DATE STRING 'Apr 10 2012'
> MEMORY_BITS INT 64
> FILE_OFFSET_BITS
> INT 64
> IDL>
> IDL> url =
> ' ftp://ftp.ngdc.noaa.gov/STP/GEOMAGNETIC_DATA/INDICES/KP_AP/2 008'
> IDL> read_ftp, url, file = '2008'
> <220- ----- Notice -----
> <220-
> <220- This is a United States Department of Commerce computer system, which
> <220- may be accessed and used only for official Government business by
> <220- authorized personnel. Unauthorized access or use of this computer
> <220- system may subject violators to criminal, civil, and/or
> administrative
> <220- action.
> <220-
> <220- All information on this computer system may be intercepted, recorded,
> <220- read, copied, and disclosed by and to authorized personnel for
> <220- official purposes, including criminal investigations. Access or
> use of
> <220- this computer system by any person whether authorized or
> unauthorized,
> <220- constitutes consent to these terms.
> <220-
> <220- ----- Notice -----
> <220-
> <220- Questions/Problems should be directed to ngdc.linux-admin@noaa.gov
> <220
>> USER anonymous
>> PASS test@test.com
>> TYPE I
>> CWD /STP/GEOMAGNETIC_DATA/INDICES/KP_AP
>> SIZE 2008
>> PASV
>> RETR 2008
>> QUIT
> IDL>
>
> And as David noted, the IDLnetUrl method was almost instantaneous. The
> socket method took 45 sec.

Curious. Worked for me on Linux:

IDL> print, !version
{ x86_64 linux unix linux 8.0.1 Oct 7 2010 64 64}

But not on OS X (Lion):

IDL> print, !version
{ x86_64 darwin unix Mac OS X 8.2 Apr 10 2012 64 64}

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
Re: FTP downloading in IDL [message #80924 is a reply to message #80923] Mon, 23 July 2012 07:58 Go to previous messageGo to next message
nerdzoo is currently offline  nerdzoo
Messages: 4
Registered: July 2012
Junior Member
On 7/21/12 3:50 PM, JBT wrote:
> Dear all,
>
> So, does anyone know a working solution to download a file from an FTP server, please? Your help is much appreciated!
>

Both socket and IDLnetUrl methods worked on my OS X Lion + IDL 8.2:

IDL> help,!version,/st
** Structure !VERSION, 8 tags, length=104, data length=100:
ARCH STRING 'x86_64'
OS STRING 'darwin'
OS_FAMILY STRING 'unix'
OS_NAME STRING 'Mac OS X'
RELEASE STRING '8.2'
BUILD_DATE STRING 'Apr 10 2012'
MEMORY_BITS INT 64
FILE_OFFSET_BITS
INT 64
IDL>
IDL> url = ' ftp://ftp.ngdc.noaa.gov/STP/GEOMAGNETIC_DATA/INDICES/KP_AP/2 008'
IDL> read_ftp, url, file = '2008'
<220- ----- Notice -----
<220-
<220- This is a United States Department of Commerce computer system, which
<220- may be accessed and used only for official Government business by
<220- authorized personnel. Unauthorized access or use of this computer
<220- system may subject violators to criminal, civil, and/or administrative
<220- action.
<220-
<220- All information on this computer system may be intercepted, recorded,
<220- read, copied, and disclosed by and to authorized personnel for
<220- official purposes, including criminal investigations. Access or use of
<220- this computer system by any person whether authorized or unauthorized,
<220- constitutes consent to these terms.
<220-
<220- ----- Notice -----
<220-
<220- Questions/Problems should be directed to ngdc.linux-admin@noaa.gov
<220
>USER anonymous
>PASS test@test.com
>TYPE I
>CWD /STP/GEOMAGNETIC_DATA/INDICES/KP_AP
>SIZE 2008
>PASV
>RETR 2008
>QUIT
IDL>

And as David noted, the IDLnetUrl method was almost instantaneous. The
socket method took 45 sec.

-Caesar
Re: FTP downloading in IDL [message #80925 is a reply to message #80924] Mon, 23 July 2012 07:16 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

On 07/21/12 19:01, JBT wrote:
> On Saturday, July 21, 2012 2:22:36 PM UTC-7, alx wrote:
>> Le samedi 21 juillet 2012 22:50:05 UTC+2, JBT a �crit : &gt; Dear all, &gt; ... &gt; So, does anyone know a working
>> solution to download a file from an FTP server, please? Your help is much appreciated! &gt; &gt; Best regards, &gt;
>> JBT
>>
>> Your last code (using IDLnetURL) works perfectly on my machine (Windows 7, IDL8.2). Did you authorize IDL to
>> communicate through the firewall of your machine ? alain.
>
> Thanks, Alain, David.
>
> I turned off the firewall on my computer and tried the IDLnetURL code again with an absolute file path for the local
> filename, but still got no luck. So, I guess it has something do with the difference between the Windows version and
> the Mac version of IDL. Does anybody have a clue on this, please?

No joy on my linux setup either:

IDL> print, !version
{ x86 linux unix linux 8.1 Mar 9 2011 32 64}
IDL> oUrl = OBJ_NEW('IDLnetUrl', URL_SCHEME='ftp', $
IDL> URL_HOST='ftp.ngdc.noaa.gov', $
IDL> URL_Port=21, $
IDL> URL_USERNAME='anonymous', URL_PASSWORD='', $
IDL> URL_PATH='STP/GEOMAGNETIC_DATA/INDICES/KP_AP/2008')
% Loaded DLM: URL.
IDL> downloadLoc = oURL->Get(FILENAME='2008')
% IDLNETURL::GET: CCurlException: Error: Ftp Get Request Failed. Error = RETR response: 425,
Curl Error Code = 19. Last Ftp Response = 425 Failed to establish connection.

Different error.

When I just do the ftp access on the command line everything worked fine.

Maybe it's a unix-related thing. I.e. IDL can't do this properly on a non-windows platform?

cheers,

paulv
Re: FTP downloading in IDL [message #80933 is a reply to message #80925] Sat, 21 July 2012 16:01 Go to previous messageGo to next message
Jianbao is currently offline  Jianbao
Messages: 16
Registered: December 2008
Junior Member
On Saturday, July 21, 2012 2:22:36 PM UTC-7, alx wrote:
> Le samedi 21 juillet 2012 22:50:05 UTC+2, JBT a écrit :
> &gt; Dear all,
> &gt; ...
> &gt; So, does anyone know a working solution to download a file from an FTP server, please? Your help is much appreciated!
> &gt;
> &gt; Best regards,
> &gt; JBT
>
> Your last code (using IDLnetURL) works perfectly on my machine (Windows 7, IDL8.2). Did you authorize IDL to communicate through the firewall of your machine ?
> alain.

Thanks, Alain, David.

I turned off the firewall on my computer and tried the IDLnetURL code again with an absolute file path for the local filename, but still got no luck. So, I guess it has something do with the difference between the Windows version and the Mac version of IDL. Does anybody have a clue on this, please?

JBT
Re: FTP downloading in IDL [message #80935 is a reply to message #80933] Sat, 21 July 2012 14:22 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le samedi 21 juillet 2012 22:50:05 UTC+2, JBT a écrit :
> Dear all,
> ...
> So, does anyone know a working solution to download a file from an FTP server, please? Your help is much appreciated!
>
> Best regards,
> JBT

Your last code (using IDLnetURL) works perfectly on my machine (Windows 7, IDL8.2). Did you authorize IDL to communicate through the firewall of your machine ?
alain.
Re: FTP downloading in IDL [message #80936 is a reply to message #80935] Sat, 21 July 2012 14:25 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
JBT writes:

> So, does anyone know a working solution to download a file from an FTP server, please? Your help is much appreciated!

I had no trouble whatsoever accessing this file. Here is
the code I used. Windows 7 64-bit OS, IDL 7.1.2.

oUrl = OBJ_NEW('IDLnetUrl', URL_SCHEME='ftp', $
URL_HOST='ftp.ngdc.noaa.gov', $
URL_Port=21, $
URL_USERNAME='anonymous', URL_PASSWORD='', $
URL_PATH='STP/GEOMAGNETIC_DATA/INDICES/KP_AP/2008')
void = oURL -> Get(FILENAME='C:\IDL\test\file_2008')

The file was retrieved nearly instantaneously.

I've gotten this CCurlException error quite a bit working
with Google static maps. It is essential that the
directory where the file will be saved actually
exists and is writeable when the Get method is
called. In my case, the problem has almost always been
writing to a particular directory. I always give it
an absolute file name, but I'm not sure if that is
a learned behavior or not. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FTP downloading in IDL [message #80958 is a reply to message #80923] Sun, 29 July 2012 12:24 Go to previous messageGo to next message
skymaxwell@gmail.com is currently offline  skymaxwell@gmail.com
Messages: 127
Registered: January 2007
Senior Member
FTP have two mode: active and passive.
Try to look at FTP_CONNECTION_MODE property and may be change it
Some FTP servers supports only passive mode
from IDL help FTP_CONNECTION_MODE - "Active (this is the default)"
Re: FTP downloading in IDL [message #81008 is a reply to message #80958] Mon, 06 August 2012 01:39 Go to previous message
Jianbao is currently offline  Jianbao
Messages: 16
Registered: December 2008
Junior Member
On Sunday, July 29, 2012 12:24:25 PM UTC-7, skymaxwell wrote:
> FTP have two mode: active and passive.
>
> Try to look at FTP_CONNECTION_MODE property and may be change it
>
> Some FTP servers supports only passive mode
>
> from IDL help FTP_CONNECTION_MODE - "Active (this is the default)"



Thank you so much, Skymaxwell! After I specified FTP_CONNECTION_MODE = 0 inside obj_new( ) for oUrl, the code worked like a snap.

JBT
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL User Group Meeting 2012
Next Topic: libcurl error with Mac OS X upgrade

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:43:24 PDT 2025

Total time taken to generate the page: 0.00445 seconds