Results 1 to 7 of 7

Thread: QSocketTCP blocking

  1. #1
    Join Date
    Dec 2013
    Location
    Jerada, Morroco
    Posts
    106
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QSocketTCP blocking

    How i can make QSocketTCP blocking without using waitForReadyRead()

    Thank you in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSocketTCP blocking

    I am seriously wondering if you are a troll.

    You are now at your fifth posting for QTcpSocket, have not replied to any of the answers given to any of them. Probably have not even read them since you keep wrting QSocketTCP.

    I am sure when I return later today I will see yet another QSocketTCP thread, asking yet another question that could have easily been answered by reading the documentation and a bit of experiementation.

    Cheers,
    _

  3. #3
    Join Date
    Dec 2013
    Location
    Jerada, Morroco
    Posts
    106
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSocketTCP blocking

    Sorry,
    I assure you that your answers were very helpful for me. because I'm still a beginner at qt level.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSocketTCP blocking

    Then you should at least indicate in the threads you start when you have all the answers you need.

    Regarding your current question: waitForSignalName is the way to do blocking operations with an otherwise non-blocking class.

    Cheers,
    _

  5. #5
    Join Date
    Dec 2013
    Location
    Jerada, Morroco
    Posts
    106
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSocketTCP blocking

    but I'm looking for how to block QSocketTCP without using waitForSignalName

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSocketTCP blocking

    If you only want to do pseudo blocking you can do something like this

    Qt Code:
    1.  
    2. connect(socket, SIGNAL(readyRead()), &loop, SLOT(quit()));
    3. loop.exec();
    To copy to clipboard, switch view to plain text mode 

    But be aware that nested event loops can be tricky.

    Cheers,
    _

  7. #7
    Join Date
    Dec 2013
    Location
    Jerada, Morroco
    Posts
    106
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSocketTCP blocking

    Thank you, your answer has been very useful.

Similar Threads

  1. QSocketTCP Is connected
    By hassinoss in forum Qt Programming
    Replies: 3
    Last Post: 13th February 2014, 16:33
  2. Delete QSocketTCP
    By hassinoss in forum Qt Programming
    Replies: 0
    Last Post: 12th February 2014, 11:02
  3. reconnect to server QSocketTCP
    By hassinoss in forum Qt Programming
    Replies: 1
    Last Post: 11th February 2014, 18:09
  4. Blocking the app
    By Alundra in forum Qt Programming
    Replies: 1
    Last Post: 1st November 2013, 03:18
  5. Blocking ftp
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2007, 08:18

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.