本文整理汇总了C++中QSslSocket::socketDescriptor方法的典型用法代码示例。如果您正苦于以下问题:C++ QSslSocket::socketDescriptor方法的具体用法?C++ QSslSocket::socketDescriptor怎么用?C++ QSslSocket::socketDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSslSocket
的用法示例。
在下文中一共展示了QSslSocket::socketDescriptor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readyReadPrivate
void SslServer::readyReadPrivate()
{
QSslSocket *socket = qobject_cast<QSslSocket*>(sender());
if (!socket)
return;
QByteArray *m_buffer = &m_buffer_hash[socket];
qint32 &m_size = m_size_hash[socket];
while (socket->bytesAvailable() > 0)
{
m_buffer->append(socket->readAll());
while ((m_size == 0 && m_buffer->size() >= 4) || (m_size > 0 && m_buffer->size() >= m_size))
{
if (m_size == 0 && m_buffer->size() >= 4)
{
m_size = getValue<qint32>(m_buffer->mid(0, 4));
m_buffer->remove(0, 4);
if (m_size < 0 || m_size > MAX_NETWORK_CHUNK_SIZE)
{
socket->abort();
return;
}
}
if (m_size > 0 && m_buffer->size() >= m_size)
{
QByteArray data = m_buffer->mid(0, m_size);
m_buffer->remove(0, m_size);
m_size = 0;
QHostAddress host = socket->peerAddress();
qintptr descriptor = socket->socketDescriptor();
PeerData pd;
pd.data = data;
pd.host = host;
pd.descriptor = descriptor;
QMetaObject::invokeMethod(this, "process", Qt::QueuedConnection, Q_ARG(PeerData, pd));
}
}
}
}