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

Author Topic: SFML - FTP not working  (Read 4261 times)

0 Members and 1 Guest are viewing this topic.

AMD

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML - FTP not working
« on: January 29, 2012, 10:06:08 pm »
Hey!

I' try to download a file over my ftp server but it don't work! :/
Here is my Code (only the login but this dont work!):
Code: [Select]
sf::Ftp ftp;
 sf::Ftp::Response response = ftp.Connect("ftp://ftp.lima-city.de");
 if (response.IsOk())
     std::cout << "Connected" << std::endl;

response = ftp.Login("amd", "xxx");
 if (response.IsOk())
     std::cout << "Logged in" << std::endl;


._.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML - FTP not working
« Reply #1 on: January 29, 2012, 10:13:08 pm »
There are many useful things in a FTP response: the status code and the response message. Can you show us what they are when it fails?
Laurent Gomila - SFML developer

AMD

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML - FTP not working
« Reply #2 on: January 29, 2012, 10:24:01 pm »
Okay I test with this code:
Code: [Select]
sf::Ftp FTP;
sf::Ftp::Response ConnectResponse = FTP.Connect("ftp://ftp.lima-city.de");
sf::Ftp::Response LoginResponse = FTP.Login("amd", "xxx");


ConnectResponse.GetStatus() = 1001
LoginResponse.GetStatus() = 1002

If I use GetMessage, then I can't compile the project.
LoginResponse.GetMessage() = 'GetMessageW': Is not an element of 'sf::Ftp::Response'

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML - FTP not working
« Reply #3 on: January 29, 2012, 10:30:04 pm »
Quote
ConnectResponse.GetStatus() = 1001

It means that the connection failed, the host is not reachable.

Quote
LoginResponse.GetMessage() = 'GetMessageW': Is not an element of 'sf::Ftp::Response'

Don't include any Windows header, or, if you can't, use #undef GetMessage.
Laurent Gomila - SFML developer

AMD

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML - FTP not working
« Reply #4 on: January 29, 2012, 10:32:54 pm »
And how can I fix this?!

My Header:
Code: [Select]
#include <iostream>
#include <string>
#include <fstream>
#include <SFML/Network.hpp>

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML - FTP not working
« Reply #5 on: January 29, 2012, 10:34:26 pm »
Which version of SFML are you using?
Laurent Gomila - SFML developer

AMD

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML - FTP not working
« Reply #6 on: January 29, 2012, 10:36:36 pm »
2.0 (Beta)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML - FTP not working
« Reply #7 on: January 29, 2012, 10:38:45 pm »
You must have a Windows header somewhere -- probably <windows.h>. Otherwise you wouldn't get this compile error about GetMessageW.
Laurent Gomila - SFML developer

AMD

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML - FTP not working
« Reply #8 on: January 29, 2012, 10:44:32 pm »
Oh your right! The include of the windows.h was in an other headerfile!

But if I'm using now the GetMessage - the program compile successfully - I get no message! It means the consol is empty.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML - FTP not working
« Reply #9 on: January 30, 2012, 08:01:16 am »
Since the error is "failed to connect", yeah, you got no message from the FTP server :)
Laurent Gomila - SFML developer