Results 1 to 10 of 10

Thread: QSslSocket problem client-server

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2012
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSslSocket problem client-server

    Yes it does
    Qt Code:
    1. void SslServer::incomingConnection(int socketDescriptor)
    2. {
    3. socket = new QSslSocket(this);
    4. qDebug() << "Nowe polaczenie nadchodzi";
    5. socket->setPrivateKey("C:\\serwer\\serverkey.pem");
    6. if(socket->privateKey().isNull())
    7. qDebug() << "Private key: false";
    8. else
    9. qDebug() << "Private key: true";
    10.  
    11. socket->setLocalCertificate("C:\\serwer\\taserver.cer");
    12. if(socket->localCertificate().isNull())
    13. qDebug() << "Certificate: false";
    14. else
    15. qDebug() << "Certificate: true";
    16.  
    17. if(socket->setSocketDescriptor(socketDescriptor))
    18. {
    19. qDebug() << "Descryptor: " << socket->socketDescriptor();
    20. socket->setProtocol(QSsl::AnyProtocol);
    21. connect(socket,SIGNAL(encrypted()),this,SLOT(ready()));
    22. connect(socket,SIGNAL(disconnected()),this,SLOT(Disconnected()));
    23. connect(socket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),SLOT(stany(QAbstractSocket::SocketState)));
    24. connect(socket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(bledy(QAbstractSocket::SocketError)));
    25. connect(socket,SIGNAL(sslErrors(QList<QSslError>)),this,SLOT(bledySSL(QList<QSslError>)));
    26. connect(socket,SIGNAL(modeChanged(QSslSocket::SslMode)),this,SLOT(mode(QSslSocket::SslMode)));
    27. connect(socket,SIGNAL(peerVerifyError(QSslError)),this,SLOT(bladPeer(QSslError)));
    28.  
    29. socket->startServerEncryption();
    30. qDebug() << socket->errorString();
    31.  
    32. qDebug() << "Connection state: " << socket->state();
    33. qDebug() << "Connection mode: " << socket->mode();
    34. }
    35. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: QSslSocket problem client-server

    What is supposed to happen is one thing. What actually happens is another.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2012
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSslSocket problem client-server

    So mayby someone have working example of client/server whit qsslsocket?

Similar Threads

  1. problem in client and server model of tcp in qt
    By shakthi in forum Qt Programming
    Replies: 1
    Last Post: 26th July 2011, 15:18
  2. QSslSocket - problem with connecting to the server
    By kremuwa in forum Qt Programming
    Replies: 9
    Last Post: 26th August 2010, 14:40
  3. server-client problem
    By sksingh73 in forum Newbie
    Replies: 2
    Last Post: 3rd July 2010, 07:18
  4. TCP server-client app problem
    By pogostick in forum Newbie
    Replies: 6
    Last Post: 25th January 2010, 08:13
  5. Qt-- Client Server communication problem
    By thisismyuname in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2010, 01:04

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
  •  
Qt is a trademark of The Qt Company.