Results 1 to 3 of 3

Thread: QFtp - commandFinished() slot is not called

  1. #1
    Join Date
    Apr 2010
    Posts
    48
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QFtp - commandFinished() slot is not called

    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 

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QFtp - commandFinished() slot is not called

    Are you able to connect?
    What does your debug output say? Is the connection still in host lookup or connecting state?

  3. #3
    Join Date
    Apr 2010
    Posts
    48
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFtp - commandFinished() slot is not called

    i solved it .
    my port number was not correct

    Thank you all

Similar Threads

  1. Slot doesn't get called
    By waynew in forum Qt Programming
    Replies: 7
    Last Post: 18th April 2010, 13:34
  2. How come this slot doesn't get called every second?
    By ShaChris23 in forum Qt Programming
    Replies: 2
    Last Post: 5th November 2009, 23:41
  3. Slot gets called twice
    By greatgatsby in forum Newbie
    Replies: 7
    Last Post: 20th August 2009, 15:11
  4. SLOT not being called
    By steg90 in forum Qt Programming
    Replies: 4
    Last Post: 6th December 2007, 11:30
  5. Replies: 8
    Last Post: 1st May 2007, 22:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.