unable to connect to FTP using IP address

370 views
Skip to first unread message

Yared Melese

unread,
Jul 20, 2016, 5:17:29 PM7/20/16
to julia-users


Hello

Would you please let me know if I missed anything, I am using FTPClient and using IP address as a host but not able to connect
Here are my commands

using FTPClient
ftp_init()
ftp = FTP(host="192.168.251.200", implt=true, ssl=true, user="anonymous", pswd="")
binary(ftp)
file = download(ftp, "dataOnFTP.bin", "C:\Users\xyz\test.bin")
close(ftp)
ftp_cleanup()

when sending  " using FTPClient" there are bunch of warnings as shown below partially
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near C:\Users\melese\.julia\v0.4\FTPClient\src\FTPC.jl:35
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near C:\Users\melese\.julia\v0.4\FTPClient\src\FTPC.jl:67
WARNING: Base.Uint8 is deprecated, use UInt8 instead.
  likely near C:\Users\melese\.julia\v0.4\FTPClient\src\FTPC.jl:81
..
.
.and at the end I am getting the following error

ERROR: Failed to connect. :: LibCURL error #7
 [inlined code] from C:\Users\melese\.julia\v0.4\FTPClient\src\FTPC.jl:138
 in ftp_command at C:\Users\melese\.julia\v0.4\FTPClient\src\FTPC.jl:454
 in ftp_connect at C:\Users\melese\.julia\v0.4\FTPClient\src\FTPC.jl:493
 in call at C:\Users\melese\.julia\v0.4\FTPClient\src\FTPObject.jl:23

Thanks
Yared

Samuel Massinon

unread,
Jul 21, 2016, 2:56:01 PM7/21/16
to julia-users
Hi Yared,

The error you are getting is something LibCURL is erring on, as described here. https://curl.haxx.se/libcurl/c/libcurl-errors.html

If I try using curl with your settings, I get
~ $ curl -u anonymous '192.168.251.200/dataOnFTP.bin'
Enter host password for user 'anonymous':
curl: (7) Failed to connect to 192.168.251.200 port 80: Network is unreachable

The FTPClient.jl uses the same library as curl and if you could post how to get the file with curl, I might be able to better serve you.

Yared Melese

unread,
Jul 26, 2016, 11:09:06 AM7/26/16
to julia-users
Hi Samuel,

Thanks for your inputs

I am trying to connect to a file server with IP address and get the latest file with certain extension then process the data and save it on local drive, then delete the file from the server.

Sorry, I don't know how to get files from Curl, it seems it is mainly designed for Http

Thanks
Yared

Samuel Massinon

unread,
Jul 26, 2016, 2:29:36 PM7/26/16
to julia-users
No worries, can you show me how you get the file with another program?

Yared Melese

unread,
Jul 27, 2016, 1:23:56 PM7/27/16
to julia-users
Hi Samuel,

Here is how it is done in matlab
% connect to ftp
f = ftp(host, username, password)
mget(f,'dataOnFTP.bin')

% read data from file
readData = fopen('dataOnFTP.bin', 'r', 'ieee-le')

%delete file from server
delete(f, 'dataOnFTP.bin');

 Here one thing not included is I would like to find the latest file from FTP server because there might be similar names with different suffix.

Thanks
Yared

Yared Melese

unread,
Aug 5, 2016, 10:22:15 AM8/5/16
to julia-users
Hi Samuel,

Would you please let me know if the information I provided is enough?

Thanks
Yared

Samuel Massinon

unread,
Aug 9, 2016, 3:26:30 PM8/9/16
to julia-users
Hi Yared

Sorry, I got side tracked by other things and forgot about this. 

Can you show what's in "host", "username", and "password"? Is it just "192.168.251.200","anonymous", and "" respectively?

I tried 
ftp('192.168.251.200', 'anonymous', '')
But got an error saying that I was unable to reach it. But that might make sense if I don't have access to it, is that the case here?

Other things that might help is that are you sure your ftp connection is over ssl? Is it implicit? Maybe playing around with `implt=true, ssl=true` in 
ftp = FTP(host="192.168.251.200", implt=true, ssl=true, user="anonymous", pswd="")
might work.

Sam

Yared Melese

unread,
Aug 17, 2016, 10:22:53 AM8/17/16
to julia-users
Hi Samuel,

Thanks

The following worked
ftp = FTP(host="192.168.255.69")
However, if I want the transfer to be in binary mode then it won't work


Thanks
Yared
Auto Generated Inline Image 1
Auto Generated Inline Image 2

Samuel Massinon

unread,
Aug 17, 2016, 11:03:50 AM8/17/16
to julia-users
Hi Yared,

Okay, since it worked with you and not me I won't be able to tests my solutions.

You don't specify that you want to download in binary when you make the connection. I'm not sure what version of FTPClient.jl you are using, but binary downloads did not work on the first version of FTPClient.jl.

If you have a correct version, you can do the following.
using FTPClient
ftp_init()
ftp = FTP(host="192.168.251.200")

file = download(ftp, "dataOnFTP.bin", "C:\Users\xyz\test.bin")
close(ftp)
ftp_cleanup()

Binary is longer a function in the latest version of FTPClient.jl and it is currently assumes that downloads are in binary. So there's no need to specify it.

Let me know if this does or doesn't work.

Samuel Massinon

unread,
Aug 31, 2016, 9:37:32 AM8/31/16
to julia-users
Hi Yared,

Hopefully my last reply worked for you.

If you have anymore questions about how to use FTPClient.jl or find other issues, you are more than welcome to make an issue here https://github.com/invenia/FTPClient.jl/issues 
I'll be more likely to see your problem there.

Cheers,
Sam

Yared Melese

unread,
Sep 2, 2016, 11:07:26 PM9/2/16
to julia...@googlegroups.com

Thanks for your help.

Reply all
Reply to author
Forward
0 new messages