Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Strange things with QSslSocket (Qt 4.7.4)
Forum Updated to NodeBB v4.3 + New Features

Strange things with QSslSocket (Qt 4.7.4)

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    p-himik
    wrote on last edited by
    #1

    Hello.
    Following code hangs up:

    @requestData(); // ask server for some data
    socket_->waitForReadyRead( -1 );@

    But following code works fine:

    @requestData();
    while( !socket_->waitForReadyRead( 1 ) )
    {
    socket_->peek( 1 ); // {1}
    QCoreApplication::processEvents(); // {2}
    }@

    Without {1} or {2} second piece of code doesn't work too. How QSslSocket::peek() can influence on QSslSocket::waitForReadyRead()? QSslSocket's readyRead() signal connected to some monitoring slot (and with the first snippet this slot is never invoked).
    I've tried QxtSignalWaiter as well but with no luck (but QxtSignalWaiter works fine with QFtp's get() and commandFinished()).
    Can someone explain me why this happens?

    I'm trying to implement synchronous class (Client) for ssl connection so, let's say, QString Client::getData( QString request ) should send request string to some server and wait for data to return to a caller. Maybe there is a better way (or already written code) for such thing?

    P.S.: Sorry for my English.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p-himik
      wrote on last edited by
      #2

      Just did some hack. Got relevant code from QxtSignalWaiter and added there
      @socket_->peek( 1 );@
      Works well but i hate such boilerplate. Still waiting for better solutions and explanations about peek().

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved