本文整理汇总了C++中QWebSocket::peerPort方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebSocket::peerPort方法的具体用法?C++ QWebSocket::peerPort怎么用?C++ QWebSocket::peerPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebSocket
的用法示例。
在下文中一共展示了QWebSocket::peerPort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onNewConnection
void ShtServer::onNewConnection()
{
QWebSocket *socket = socketServer->nextPendingConnection();
connect(socket, &QWebSocket::textMessageReceived, this, &ShtServer::onTextMessage);
connect(socket, &QWebSocket::disconnected, this, &ShtServer::onSocketDisconnected);
//onlineSockets << socket;
qWarning() << "Added socket " << socket->peerName() << ":" << socket->peerPort();
}
示例2: onSocketDisconnected
void CardReader::onSocketDisconnected()
{
QWebSocket *webSocket = qobject_cast<QWebSocket *>(sender());
if (webSocket) {
clients.removeAll(webSocket);
frontend_message(
QStringLiteral("Client disconnected from %1:%2, now %3 connected client(s) [reason: %4]")
.arg(webSocket->peerAddress().toString())
.arg(webSocket->peerPort())
.arg(clients.length())
.arg(webSocket->closeCode())
);
webSocket->deleteLater();
}
}
示例3: onNewConnection
void CardReader::onNewConnection()
{
QWebSocket *webSocket = server->nextPendingConnection();
connect(webSocket, &QWebSocket::disconnected, this, &CardReader::onSocketDisconnected);
connect(webSocket, static_cast<void(QWebSocket::*)(QAbstractSocket::SocketError)>(&QWebSocket::error), this, &CardReader::onSocketError);
connect(webSocket, &QWebSocket::sslErrors, this, &CardReader::onSslError);
clients.append(webSocket);
frontend_message(QStringLiteral("Client connected from %1:%2, now %3 connected client(s)").arg(webSocket->peerAddress().toString()).arg(webSocket->peerPort()).arg(clients.length()));
}
示例4: onNewConnection
void ReverseHashDServer::onNewConnection(){
QWebSocket *pSocket = m_pReverseHashDServer->nextPendingConnection();
std::cout << "NewConnection " << pSocket->peerAddress().toString().toStdString() << " " << pSocket->peerPort() << "\n";
connect(pSocket, &QWebSocket::textMessageReceived, this, &ReverseHashDServer::processTextMessage);
connect(pSocket, &QWebSocket::binaryMessageReceived, this, &ReverseHashDServer::processBinaryMessage);
connect(pSocket, &QWebSocket::disconnected, this, &ReverseHashDServer::socketDisconnected);
m_clients << pSocket;
}