不支持 ssl 套接字错误

ssl sockets not supported error

我是 运行 tornado 网络服务器,用于 linux centos 6.6 上的安全 websocket 连接。我正在使用 Qt/c++ 客户端通过打开 url(如 "wss://191.23.4.56/etr/job")使用 QWebsocket 进行连接。 我收到这样的错误, “此平台不支持 SSL 套接字” 这个错误是关于什么的?

当URL方案为wss和[=12=时,QWebSocket::open()打印错误信息"SSL sockets are not supported in this platform" ] returns false.

静态成员函数QSslSocket::supportsSsl():

Returns true if this platform supports SSL; otherwise, returns false. If the platform doesn't support SSL, the socket will fail in the connection phase.

这是你的主要问题。现在我们需要找出为什么 Qt 认为平台不支持 SSL。

如果您将 Qt 作为二进制包下载,函数 supportsSsl() 会尝试动态加载所需的库 libssllibcrypto

如果无法加载这些库函数 supportsSsl() returns false.

您的系统中可能没有安装 libssl。如果您可以在您的系统中找到库二进制文件,但它们不是由 Qt 加载的,则可能是您的二进制文件 libssl and/or libcrypto 与二进制 Qt 不兼容。

要避免此类问题,您可以构建自己的 Qt。例如,有一个新的说明如何构建 Qt-5.5.1。注意 -openssl-linked 配置开关的技巧。它支持将 OpenSSL 库集成到 Qt5 库中,而不是在运行时动态加载它们。