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.

Qt Code:
  1. MyFTP::MyFTP ()
  2. //********************
  3. {
  4. setupUi ( this );
  5.  
  6. connect ( myUploadPB, SIGNAL( clicked() ), this, SLOT( connectServer() ));
  7.  
  8. myFtp = new QFtp();
  9.  
  10. connect( myFtp, SIGNAL( commandStarted ( int ) ),
  11. this, SLOT( ftp_commandStarted ( int ) ));
  12.  
  13. connect( myFtp, SIGNAL( stateChanged ( int )),
  14. this, SLOT( ftp_stateChanged ( int ) ));
  15.  
  16. connect( myFtp, SIGNAL( commandFinished( int, bool )),
  17. this, SLOT( ftp_commandFinished( int, bool )) );
  18.  
  19. connect( myFtp, SIGNAL( done( bool ) ),
  20. this, SLOT( ftp_done( bool ) ) );
  21.  
  22.  
  23. }
  24.  
  25. MyFTP::~MyFTP ()
  26. //********************
  27. {
  28.  
  29. }
  30.  
  31. void MyFTP::connectServer ()
  32. //**************************
  33. {
  34. int aPortNumber = 22;
  35.  
  36. myProcessId = myFtp->connectToHost( "182.168.0.223", aPortNumber );
  37.  
  38. myFtp->login("jayabharathy","jayabharathy");
  39.  
  40. }
  41.  
  42. void MyFTP::commandStarted(int a)
  43. {
  44. qDebug ()<<"commandStarted";
  45. qDebug ()<<a;
  46.  
  47. }
  48.  
  49. void MyFTP::ftp_commandStarted(int a)
  50. {
  51. qDebug ()<<"ftp commandStarted";
  52. qDebug ()<<a;
  53.  
  54.  
  55. }
  56.  
  57. void MyFTP::commandFinished(int , bool )
  58. {
  59. qDebug ()<<"commandFinished";
  60.  
  61. }
  62.  
  63. void MyFTP::ftp_commandFinished(int , bool )
  64. {
  65. qDebug ()<<"ftp_commandFinished";
  66.  
  67.  
  68. }
  69. void MyFTP::done(bool error)
  70. {
  71. qDebug ()<<"ftpstatechangesc"<<error;
  72.  
  73. }
  74. void MyFTP::ftp_done(bool error)
  75. {
  76. qDebug ()<<"ftpstatechangesc"<<error;
  77.  
  78. }
  79.  
  80.  
  81. void MyFTP::stateChanged(int a)
  82. {
  83. qDebug ()<<"statechanged"<<a;
  84.  
  85. }
  86.  
  87.  
  88. void MyFTP::ftp_stateChanged(int state)
  89. {
  90. qDebug ()<<myFtp->currentId ();
  91.  
  92. qDebug ()<<myFtp->hasPendingCommands ();
  93.  
  94. qDebug ()<<myFtp->errorString ();
  95.  
  96.  
  97. qDebug("State Change");
  98. switch ( (QFtp::State)state ) {
  99. case QFtp::Unconnected:
  100. qDebug("Unconnected");
  101. break;
  102. case QFtp::HostLookup:
  103. qDebug("Host lookup");
  104. break;
  105. case QFtp::Connecting:
  106. qDebug("Connecting");
  107. break;
  108. case QFtp::Connected:
  109. qDebug("Connected");
  110. break;
  111. case QFtp::LoggedIn:
  112. qDebug("Logged in");
  113. break;
  114. case QFtp::Closing:
  115. qDebug("Closing");
  116. break;
  117. }
To copy to clipboard, switch view to plain text mode