Overview
Features
Download
Documentation
Community
Add-Ons & Services

FTP client using FTPClientSession

General discussion regarding the development of POCO for contributors.
sgajendran.rev
Posts: 1
Joined: 23 Oct 2008, 16:43

FTP client using FTPClientSession

Postby sgajendran.rev » 30 Oct 2008, 16:11

Dear All,

I have gone through the classes under FTP. There are three classes specified. I want to create a FTP Client using FTPClientSession. When I use the constructor to create socket and open up the host, I got "Connection Timeout" error.

I am sure that I am missing something. Please review the code and help me out to connect using FTPClientSession. Using FTPClientSession only we can create our own FTP client by using the members in FTPClientSession class.

Code snippet :

Code: Select all



int main()
{
  HTTPStreamFactory::registerFactory();
  FTPStreamFactory::registerFactory();
  try
  {
     std::string host="ftp://www.myhost.com";  //My FTP host
     Poco::UInt16 port=21; //FTP Port
     FTPClientSession log(host,port);
     log.login("tom","jerry");
     return 1;
  }
  catch (Exception& exc)
  {
     std::cerr << exc.displayText() << std::endl;
     return 1;
  }
  return 0;
}


peter
Posts: 67
Joined: 11 Jul 2006, 16:26
Location: Austria

Re: FTP client using FTPClientSession

Postby peter » 31 Oct 2008, 14:20

> Dear All,
>
> I have gone through the classes under FTP. There are three classes specified. I want to create a FTP Client using FTPClientSession. When I use the constructor to create socket and open up the host, I got "Connection Timeout" error.
>
> I am sure that I am missing something. Please review the code and help me out to connect using FTPClientSession. Using FTPClientSession only we can create our own FTP client by using the members in FTPClientSession class.
>

Try without the ftp prefix for host:

Code: Select all


 
 int main()
 {

  try
   {
      std::string host="www.myhost.com";  //My FTP host
      Poco::UInt16 port=21; //FTP Port
      FTPClientSession log(host,port);
      log.login("tom","jerry");
      return 1;
  }
  catch (Exception& exc)
  {
    [...]


Return to “Contributors”

Who is online

Users browsing this forum: No registered users and 1 guest