[Interest] Using QSslSocket as QTcpSocket

71 views
Skip to first unread message

Chaser

unread,
Nov 21, 2011, 12:06:18 PM11/21/11
to inte...@qt-project.org
Hi all! Can a QSslSocket to work as QTcpSocket at unencrypted
connenctions? I don't want inherit from QTcpSocket for unencrypted
connenctions and from QSslSocket for encrypted connenctions, and have
two classes with duplicated code, so is it possible to use QSslSocket
for both cases?
And what about overhead and perfomance?
_______________________________________________
Interest mailing list
Inte...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Jason H

unread,
Nov 21, 2011, 12:27:43 PM11/21/11
to Chaser, inte...@qt-project.org
Sure. SSL sockets are tcp Sockets, save for the negotiation. If you don't want encryption, just don't call startServerEncription or the client version.

However, I would have to ask, why not just abstract it to be QTcpSocket*?

There is no overhead if you are encrypting.

In all my code, the only difference is if you are on a secure port, then you start the encryption. Also, you should have some way of reporting the SSL errors.



From: Chaser <chaser...@gmail.com>
To: inte...@qt-project.org
Sent: Monday, November 21, 2011 12:06 PM
Subject: [Interest] Using QSslSocket as QTcpSocket

Jason H

unread,
Nov 21, 2011, 12:28:35 PM11/21/11
to Jason H, Chaser, inte...@qt-project.org
Correction: There is no overhead if you are NOT encrypting.


From: Jason H <scor...@yahoo.com>
To: Chaser <chaser...@gmail.com>; "inte...@qt-project.org" <inte...@qt-project.org>
Sent: Monday, November 21, 2011 12:27 PM
Subject: Re: [Interest] Using QSslSocket as QTcpSocket

Chaser

unread,
Nov 22, 2011, 3:53:43 AM11/22/11
to Jason H, inte...@qt-project.org
Oh, thanks! You really helped me!
I implement WebSocket's server, so one client may connect on secure mode, and
another - on non-secure mode.
Reply all
Reply to author
Forward
0 new messages