简体   繁体   English

Java TCP-Server:用于测试的多个本地客户端

[英]Java TCP-Server: Multiple local Clients for testing

So, I'm working on a Server/Client application at the moment, and need to test certain scenarios where multiple clients connect to the server and interact with each other.因此,我目前正在开发服务器/客户端应用程序,需要测试多个客户端连接到服务器并相互交互的某些场景。

The problem here is as follows: I somehow can't connect with more than one client per machine, the server just does not accept any connection attempt after the first one connected.这里的问题如下:我以某种方式无法与每台机器连接多个客户端,服务器在第一个连接后不接受任何连接尝试。

I know that it SHOULD work, as tons of other applications support multiple clients on one machine too.我知道它应该可以工作,因为大量其他应用程序也支持一台机器上的多个客户端。

I could - of course - test this on another machine, but I do not want to compile and send my program to my secondary computer each time after I made changes to the code.我当然可以在另一台机器上测试这个,但我不想在每次更改代码后编译我的程序并将其发送到我的辅助计算机。

I hope I described my problem well and provided enough info so that you can help me with that case.我希望我很好地描述了我的问题并提供了足够的信息,以便您可以帮助我解决这个问题。

The issue is probably that the way your server is coded it either doesn't accept multiple clients at all or it is dependant on all clients having a unique IP address.问题可能是您的服务器的编码方式根本不接受多个客户端,或者它依赖于具有唯一 IP 地址的所有客户端。

I would suggest testing with 2 clients on different computers just to see if it can accept multiple clients at all.我建议在不同的计算机上测试 2 个客户端,看看它是否可以接受多个客户端。 That will help narrow down the exact issue to one of the ones I mentioned above.这将有助于将确切问题缩小到我上面提到的问题之一。

Disclaimer: I'm not an expert in the field of networking, but I've attempted to assist to the best of my understanding免责声明:我不是网络领域的专家,但我已尽我所能提供帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM