如何测试Winsock多个客户端 [英] How to test Winsock Multiple Clients

查看:79
本文介绍了如何测试Winsock多个客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个客户端服务器应用程序,其中多个客户端使用Winsock连接到服务器.在测试期间,服务器和客户端应用程序都位于同一台计算机(我的开发计算机)上.我可以使用Loopback接口一次将一个客户端连接到服务器.如何在同一台计算机(本地主机)上测试多个客户端?我尝试使用客户端应用程序的多个实例,但是由于所有客户端都从同一台计算机连接,因此服务器无法识别新连接.

问候,

Nejimon CR

Hi all,

I have a client-server application, in which multiple clients connect to the server using Winsock. While testing, both server and client applications reside on the same machine (my development machine). I can connect one client at a time to the server using Loopback interface. How can I test multiple clients on the same machine (localhost)? I tried with multiple instances of client application, but because all clients connect from the same machine, the server is not able to identify new connections.

Regards,

Nejimon CR

推荐答案

如果服务器仅通过IP地址识别客户端,则它将无法区分客户端.如果您有多个客户端实例,所有实例都在一台计算机上运行,​​则每个计算机都应使用不同的端口连接到服务器.如果服务器通过IP 端口识别客户端,则服务器应该没有问题.
If the server identifies the clients only by IP Address then it won''t be able to distinguish clients. If you have multiple instances of the client all running on one machine each one should be using a different port to connect to the server. If the server identifies clients by IP and Port then the server shouldn''t have a problem.


这篇关于如何测试Winsock多个客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆