Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [FIXED] FTP cannot download file: status is 1003  (Read 6088 times)

0 Members and 1 Guest are viewing this topic.

drhaximus

  • Newbie
  • *
  • Posts: 9
    • View Profile
[FIXED] FTP cannot download file: status is 1003
« on: March 22, 2014, 01:26:17 am »
FIXED.
Refer to the last post for how to fix it.


Hello.
When I try to download a file from a FTP server, I'm able to connect, change directories, get files inside of current directory etc, no connection issues and whatever, but I still get a 1003 error as a status of my download. There's no string inside of getMessage() either.

Here's what I do:

sf::Ftp::Response x=ftp.download("master.txt","C:\"master.txt");
std::cout<<"FTP Download: "<<x.getStatus()<<" : "<<x.getMessage()<<"\n";

It prints:
FTP Download: 1003 :
Nothing after.

Here's the server's log of the ecounter:

Quote
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 230 Logged on
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> PWD
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 257 "/" is current directory.
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> CWD 0.12/
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 250 CWD successful. "/0.12" is current directory.
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> PASV
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,199,216)
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> TYPE I
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 200 Type set to I
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> RETR /0.12//master.txt
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 150 Connection accepted
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 226 Transfer OK
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> PWD
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 257 "/0.12" is current directory.
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> PASV
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,199,218)
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> TYPE A
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 200 Type set to A
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> NLST /0.12
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 150 Connection accepted
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 226 Transfer OK
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> QUIT
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> 221 Goodbye
(000032)3/22/2014 13:25:37 PM - update (127.0.0.1)> disconnected.

Thanks.
« Last Edit: March 22, 2014, 10:42:18 pm by drhaximus »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: FTP cannot download file: status is 1003
« Reply #1 on: March 22, 2014, 01:47:03 am »
Maybe if you searched through the documentation a bit more, you would get a slightly more meaningful FTP response code from SFML. Numbers always have a meaning. You just have to look for them.

ftp.download("master.txt","C:\"master.txt");
Windows users really have it hard...
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

drhaximus

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: FTP cannot download file: status is 1003
« Reply #2 on: March 22, 2014, 07:20:56 am »
Maybe if you searched through the documentation a bit more, you would get a slightly more meaningful FTP response code from SFML. Numbers always have a meaning. You just have to look for them.

ftp.download("master.txt","C:\"master.txt");
Windows users really have it hard...

I've already checked there, it just says this:
Quote
InvalidFile = 1003
I'm not sure what classifies an invalid file; the server says the request is fine and everything completes as shown by the server logs.
Has anybody got any information how I can fix this InvalidFile?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: FTP cannot download file: status is 1003
« Reply #3 on: March 22, 2014, 07:56:24 am »
Quote
"C:\"master.txt"
Look at this string twice. Nothing's wrong? :P
Laurent Gomila - SFML developer

drhaximus

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: FTP cannot download file: status is 1003
« Reply #4 on: March 22, 2014, 08:39:39 am »
Quote
"C:\"master.txt"
Look at this string twice. Nothing's wrong? :P
I've changed this to "master.txt" etc, I've also tried creating the file in that path.

Nothing.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: FTP cannot download file: status is 1003
« Reply #5 on: March 22, 2014, 09:38:18 am »
What they meant to say is, that it should be C:/master.txt. The back-slash is an escaping character, so writing C:\"master.txt will essentially be translated as C:"master.txt.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

drhaximus

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: FTP cannot download file: status is 1003
« Reply #6 on: March 22, 2014, 10:06:49 am »
What they meant to say is, that it should be C:/master.txt. The back-slash is an escaping character, so writing C:\"master.txt will essentially be translated as C:"master.txt.

That's entirely irrelivant, in the post above yours I stated that I have changed it to the current directory of the executable, AKA "master.txt"

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: FTP cannot download file: status is 1003
« Reply #7 on: March 22, 2014, 02:33:14 pm »
http://sfml-dev.org/documentation/2.1/classsf_1_1Ftp.php#a20c1600ec5fd6f5a2ad1429ab8aa5df4
Quote
localPath   Where to put to file on the local computer
I don't know if this should be more explicit. Obviously eXpl0it3r and drhaximus understand this to be an absolute path to a file, whereas in the code it is implemented as the destination directory in which to create a file with the same name as the remote file. I understood it as it was coded but I guess it can be ambiguous depending on what background you come from.

Maybe rephrasing it to "The directory in which to put the file on the local computer" might make it more clear.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: FTP cannot download file: status is 1003
« Reply #8 on: March 22, 2014, 02:37:09 pm »
Good idea, I can improve the documentation.

By the way, the same applies to remotePath in upload().
« Last Edit: March 22, 2014, 02:39:48 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

drhaximus

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: FTP cannot download file: status is 1003
« Reply #9 on: March 22, 2014, 10:39:32 pm »
http://sfml-dev.org/documentation/2.1/classsf_1_1Ftp.php#a20c1600ec5fd6f5a2ad1429ab8aa5df4
Quote
localPath   Where to put to file on the local computer
I don't know if this should be more explicit. Obviously eXpl0it3r and drhaximus understand this to be an absolute path to a file, whereas in the code it is implemented as the destination directory in which to create a file with the same name as the remote file. I understood it as it was coded but I guess it can be ambiguous depending on what background you come from.

Maybe rephrasing it to "The directory in which to put the file on the local computer" might make it more clear.

So I'm supposed to specify the directory ommitting the actual file name? Like "/folder/"?

drhaximus

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: FTP cannot download file: status is 1003
« Reply #10 on: March 22, 2014, 10:41:24 pm »
http://sfml-dev.org/documentation/2.1/classsf_1_1Ftp.php#a20c1600ec5fd6f5a2ad1429ab8aa5df4
Quote
localPath   Where to put to file on the local computer
I don't know if this should be more explicit. Obviously eXpl0it3r and drhaximus understand this to be an absolute path to a file, whereas in the code it is implemented as the destination directory in which to create a file with the same name as the remote file. I understood it as it was coded but I guess it can be ambiguous depending on what background you come from.

Maybe rephrasing it to "The directory in which to put the file on the local computer" might make it more clear.

So I'm supposed to specify the directory ommitting the actual file name? Like "/folder/"?

This is exactly what to do.
To fix what I was doing wrong, simply specify the directory WITHOUT the filename, so the line which downloads the file is now:

sf::Ftp::Response x=ftp.download("master.txt","");

Thanks.