[英]Simulate running multiple server and client instances using Java concurrency
I want to simulate running of multiple servers and clients on a single machine. 我想在一台计算机上模拟多个服务器和客户端的运行。
I plan to create multiple threads of servers and clients using Java's concurrency package. 我计划使用Java的并发包创建服务器和客户端的多个线程。
I will differentiate between servers and clients from each other and among them using only port numbers. 我将仅使用端口号来区分服务器和客户端。
Say, I will have a series of 800XX ports for servers and 900XX ports for clients. 说,我将有一系列用于服务器的800XX端口和用于客户端的900XX端口。
I need to know if what I am doing is correct. 我需要知道我在做什么是否正确。 Is there a better way of doing it?
有更好的方法吗?
Your idea is correct. 你的想法是正确的。 One minor comment is that the client ports can be automatically allocated by system.
一个小意见是,客户端端口可以由系统自动分配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.