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. Why my SSL client/server doesn't work?
Forum Updated to NodeBB v4.3 + New Features

Why my SSL client/server doesn't work?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k 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.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #1

    Hi everybody.
    I wrote a client and server that use SSL to communicate but they don't work.
    Here is the code I wrote

    Server:
    @
    void LanServer::incomingConnection(int socketDescriptor){
    //LanServer inherits from QTcpServer
    /tcpSocket is a pointer to a QSslSocket allocated on the heap in LanServer constructor/
    if (!tcpSocket->setSocketDescriptor(socketDescriptor)) {
    emit error(tcpSocket->error());
    return;
    }
    tcpSocket->startServerEncryption();
    }
    @

    Client:
    @
    void LanClient::ConnectToHost(){
    //LanClient inherits from QObject
    /tcpSocket is a pointer to a QSslSocket allocated on the heap in LanClient constructor/
    tcpSocket->connectToHost("localhost",7677);
    if(!tcpSocket->waitForConnected())
    emit CantConnect();
    tcpSocket->startClientEncryption();
    if(!tcpSocket->waitForEncrypted())
    emit CantConnect(); //This is always executed
    }
    @

    Can you please help me solve this problem?

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    1 Reply Last reply
    0
    • B Offline
      B Offline
      b1gsnak3
      wrote on last edited by
      #2

      check if incomingConnection is called... A friend encountered that problem also when he tried to rewrite incomingConnection...

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        It's called and the connection is established, what fails is the encryption

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        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