当前位置: 首页>>代码示例>>C++>>正文


C++ QWebSocket::peerPort方法代码示例

本文整理汇总了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();
}
开发者ID:illogica,项目名称:Sht,代码行数:8,代码来源:shtserver.cpp

示例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();
	}
}
开发者ID:SVArago,项目名称:Arago-Card-Reader,代码行数:15,代码来源:cardreader.cpp

示例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()));
}
开发者ID:SVArago,项目名称:Arago-Card-Reader,代码行数:10,代码来源:cardreader.cpp

示例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;
}
开发者ID:sea-kg,项目名称:reversehash,代码行数:11,代码来源:reversehashd_server.cpp


注:本文中的QWebSocket::peerPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。