newb
7th May 2010, 04:32
Dear Friends,
I m very new to Qt world..and this is my first post....
I am trying to do File uploading and downloading from the ftp server using Qt Ftp class.
I can able to connect to the server, but i cant able to logging in to it.
myFtp->connectToHost( "192.168.0.223", aPortNumber ); -> This calls the commandStarted () slot.
But after connecting to the server, commandFinished() slot is not called.
I cant trigger out what the problem could be.
Please have a look at my code below.
Thank you for your time.
MyFTP::MyFTP ()
//********************
{
setupUi ( this );
connect ( myUploadPB, SIGNAL( clicked() ), this, SLOT( connectServer() ));
myFtp = new QFtp();
connect( myFtp, SIGNAL( commandStarted ( int ) ),
this, SLOT( ftp_commandStarted ( int ) ));
connect( myFtp, SIGNAL( stateChanged ( int )),
this, SLOT( ftp_stateChanged ( int ) ));
connect( myFtp, SIGNAL( commandFinished( int, bool )),
this, SLOT( ftp_commandFinished( int, bool )) );
connect( myFtp, SIGNAL( done( bool ) ),
this, SLOT( ftp_done( bool ) ) );
}
MyFTP::~MyFTP ()
//********************
{
}
void MyFTP::connectServer ()
//**************************
{
int aPortNumber = 22;
myProcessId = myFtp->connectToHost( "182.168.0.223", aPortNumber );
myFtp->login("jayabharathy","jayabharathy");
}
void MyFTP::commandStarted(int a)
{
qDebug ()<<"commandStarted";
qDebug ()<<a;
}
void MyFTP::ftp_commandStarted(int a)
{
qDebug ()<<"ftp commandStarted";
qDebug ()<<a;
}
void MyFTP::commandFinished(int , bool )
{
qDebug ()<<"commandFinished";
}
void MyFTP::ftp_commandFinished(int , bool )
{
qDebug ()<<"ftp_commandFinished";
}
void MyFTP::done(bool error)
{
qDebug ()<<"ftpstatechangesc"<<error;
}
void MyFTP::ftp_done(bool error)
{
qDebug ()<<"ftpstatechangesc"<<error;
}
void MyFTP::stateChanged(int a)
{
qDebug ()<<"statechanged"<<a;
}
void MyFTP::ftp_stateChanged(int state)
{
qDebug ()<<myFtp->currentId ();
qDebug ()<<myFtp->hasPendingCommands ();
qDebug ()<<myFtp->errorString ();
qDebug("State Change");
switch ( (QFtp::State)state ) {
case QFtp::Unconnected:
qDebug("Unconnected");
break;
case QFtp::HostLookup:
qDebug("Host lookup");
break;
case QFtp::Connecting:
qDebug("Connecting");
break;
case QFtp::Connected:
qDebug("Connected");
break;
case QFtp::LoggedIn:
qDebug("Logged in");
break;
case QFtp::Closing:
qDebug("Closing");
break;
}
I m very new to Qt world..and this is my first post....
I am trying to do File uploading and downloading from the ftp server using Qt Ftp class.
I can able to connect to the server, but i cant able to logging in to it.
myFtp->connectToHost( "192.168.0.223", aPortNumber ); -> This calls the commandStarted () slot.
But after connecting to the server, commandFinished() slot is not called.
I cant trigger out what the problem could be.
Please have a look at my code below.
Thank you for your time.
MyFTP::MyFTP ()
//********************
{
setupUi ( this );
connect ( myUploadPB, SIGNAL( clicked() ), this, SLOT( connectServer() ));
myFtp = new QFtp();
connect( myFtp, SIGNAL( commandStarted ( int ) ),
this, SLOT( ftp_commandStarted ( int ) ));
connect( myFtp, SIGNAL( stateChanged ( int )),
this, SLOT( ftp_stateChanged ( int ) ));
connect( myFtp, SIGNAL( commandFinished( int, bool )),
this, SLOT( ftp_commandFinished( int, bool )) );
connect( myFtp, SIGNAL( done( bool ) ),
this, SLOT( ftp_done( bool ) ) );
}
MyFTP::~MyFTP ()
//********************
{
}
void MyFTP::connectServer ()
//**************************
{
int aPortNumber = 22;
myProcessId = myFtp->connectToHost( "182.168.0.223", aPortNumber );
myFtp->login("jayabharathy","jayabharathy");
}
void MyFTP::commandStarted(int a)
{
qDebug ()<<"commandStarted";
qDebug ()<<a;
}
void MyFTP::ftp_commandStarted(int a)
{
qDebug ()<<"ftp commandStarted";
qDebug ()<<a;
}
void MyFTP::commandFinished(int , bool )
{
qDebug ()<<"commandFinished";
}
void MyFTP::ftp_commandFinished(int , bool )
{
qDebug ()<<"ftp_commandFinished";
}
void MyFTP::done(bool error)
{
qDebug ()<<"ftpstatechangesc"<<error;
}
void MyFTP::ftp_done(bool error)
{
qDebug ()<<"ftpstatechangesc"<<error;
}
void MyFTP::stateChanged(int a)
{
qDebug ()<<"statechanged"<<a;
}
void MyFTP::ftp_stateChanged(int state)
{
qDebug ()<<myFtp->currentId ();
qDebug ()<<myFtp->hasPendingCommands ();
qDebug ()<<myFtp->errorString ();
qDebug("State Change");
switch ( (QFtp::State)state ) {
case QFtp::Unconnected:
qDebug("Unconnected");
break;
case QFtp::HostLookup:
qDebug("Host lookup");
break;
case QFtp::Connecting:
qDebug("Connecting");
break;
case QFtp::Connected:
qDebug("Connected");
break;
case QFtp::LoggedIn:
qDebug("Logged in");
break;
case QFtp::Closing:
qDebug("Closing");
break;
}