如何使用TCP将事件连接到服务器 [英] how to connect an event to a server using tcp
本文介绍了如何使用TCP将事件连接到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
void testCFTcpServer()
{
CFTcpServer server;
int port = 8000;
if(!server.setup(port))
{
std::cout << std::endl << "server setup failed"<< std::endl;
return;
}
std::cout << std::endl << "server running"<< std::endl;
CFRunLoopRun();
}
我如何在此服务器程序中使用设备回调事件...
我该怎么办?
How can I use the device call back event here in this server program...
what should I do?
推荐答案
您需要一个客户端,一个与网络类CFTcpServer通信的计数器.例如,创建一个连接到您的服务器的客户端套接字(在您的示例中为端口8000),然后针对每个鼠标事件收集相关信息并将其发送到服务器.从一个简单的网络示例开始.
You need a client, a counter part which communicates to your networking class CFTcpServer. For example create a client socket that connects to you server (port 8000 in your example), then for each mouse event collect the relevant information and send it to the server. Start with a simple networking example.
这篇关于如何使用TCP将事件连接到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文