Results 1 to 3 of 3

Thread: QTcpSocket + Windows

  1. #1
    Join Date
    Sep 2008
    Posts
    17
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTcpSocket + Windows

    Hi all!

    I'm new to socket programming on windows.
    I made a client application working on linux using qtcpsocket, and it workd perfectly.

    I compiled it on windows, but it doesn't connect. Acutally, it might not try to connect.
    So, nothing happen. What should I do? Where is the problem.
    I found nothing relevant on the internet.

    The connection:

    Qt Code:
    1. void sudoku::on_connectButton_clicked()
    2. {
    3. if( connected == false )
    4. {
    5. tcpSocket->abort();
    6. tcpSocket->connectToHost(host,port);
    7. ui.sendButton->setEnabled(true);
    8. ui.connectButton->setText(QString("Disconnect"));
    9. connected = true;
    10. }
    11. else
    12. {
    13. tcpSocket->abort();
    14. ui.sendButton->setEnabled(false);
    15. ui.connectButton->setText(QString("Connect"));
    16. connected = false;
    17. }
    18.  
    19. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 10th January 2009 at 15:46. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTcpSocket + Windows

    Maybe a firewall is blocking the connection?

    By the way, calling connectToHost() doesn't mean the socket is immediately connected. This is an asynchronous call, remember that. It only means the application is currently TRYING to connect.

  3. #3
    Join Date
    Sep 2008
    Posts
    17
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpSocket + Windows

    Thanks, I ckecked it, but no effect.

    One day later with a newer program at server side, it works!
    Firewall doesn't matter. I don't know, what was the reason..

Similar Threads

  1. Opening text file fails after autostartup on windows
    By yogourta in forum Qt Programming
    Replies: 2
    Last Post: 18th October 2008, 03:52
  2. Windows not appearing in XP.
    By beardybloke in forum Qt Programming
    Replies: 7
    Last Post: 24th October 2007, 17:32
  3. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 20:44
  4. converting unix exe to windows binary
    By deekayt in forum General Programming
    Replies: 2
    Last Post: 17th September 2006, 01:00
  5. MDI windows without QWorkspace
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 17:15

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.