Overview
Features
Download
Documentation
Community
Add-Ons & Services

Problem in FTP log in

General discussion regarding the development of POCO for contributors.

Problem in FTP log in

Postby AnithaSubramani » 24 Oct 2008, 07:57

HI All,

Im trying to modify some part of the code in FTP download program. But my code didnt log in to ftp server.My modified code is:


#include "Poco/URIStreamOpener.h"
#include "Poco/StreamCopier.h"
#include "Poco/Path.h"
#include "Poco/URI.h"
#include "Poco/Exception.h"
#include "Poco/Net/FTPClientSession.h"
#include "Poco/Net/HTTPStreamFactory.h"
#include "Poco/Net/FTPStreamFactory.h"
#include
#include


using Poco::URIStreamOpener;
using Poco::StreamCopier;
using Poco::Path;
using Poco::URI;
using Poco::Exception;
using Poco::Net::HTTPStreamFactory;
using Poco::Net::FTPStreamFactory;
using Poco::Net::FTPPasswordProvider;
using Poco::Net::FTPClientSession;


int main(int argc, char** argv)
{
std::string username = "can";

HTTPStreamFactory::registerFactory();

try
{
URI uri("ftp://192.168.66.66");
std::string host = "ftp://imagine.com";
Poco::UInt16 port = 21;
FTPClientSession sess(host,port);
Poco::Timespan timeout = 5000;
sess.setTimeout(timeout);
sess.login("can","can");
return 1;
}
catch (Exception& exc)
{
std::cerr << exc.displayText() << std::endl;
return 1;
}
return 0;
}

If i have done any mistake in my code please correct it.
How to login to the ftp server.

Thanks & Regards,
Anitha
AnithaSubramani
 
Posts: 7
Joined: 20 Oct 2008, 14:48

Re: Problem in FTP log in

Postby AnithaSubramani » 24 Oct 2008, 11:57

> HI All,
>
> Im trying to modify some part of the code in FTP download program. But my code didnt log in to ftp server.My modified code is:
>
>
> #include "Poco/URIStreamOpener.h"
> #include "Poco/StreamCopier.h"
> #include "Poco/Path.h"
> #include "Poco/URI.h"
> #include "Poco/Exception.h"
> #include "Poco/Net/FTPClientSession.h"
> #include "Poco/Net/HTTPStreamFactory.h"
> #include "Poco/Net/FTPStreamFactory.h"
> #include
> #include
>
>
> using Poco::URIStreamOpener;
> using Poco::StreamCopier;
> using Poco::Path;
> using Poco::URI;
> using Poco::Exception;
> using Poco::Net::HTTPStreamFactory;
> using Poco::Net::FTPStreamFactory;
> using Poco::Net::FTPPasswordProvider;
> using Poco::Net::FTPClientSession;
>
>
> int main(int argc, char** argv)
> {
> std::string username = "java";
>
> HTTPStreamFactory::registerFactory();
>
> try
> {
> URI uri("ftp://192.168.66.66");
> std::string host = "ftp://imagine.com";
> Poco::UInt16 port = 21;
> FTPClientSession sess(host,port);
> Poco::Timespan timeout = 5000;
> sess.setTimeout(timeout);
> sess.login("can","can");
> return 1;
> }
> catch (Exception& exc)
> {
> std::cerr }
> return 0;
> }
>
> If i have done any mistake in my code please correct it.
> How to login to the ftp server.
>
> Thanks & Regards,
> Anitha
AnithaSubramani
 
Posts: 7
Joined: 20 Oct 2008, 14:48


Return to Contributors

Who is online

Users browsing this forum: No registered users and 3 guests

cron