简体   繁体   中英

Java networking: how to simulate two different computers?

I want to start network programming in Java. What's the best way to go about it in terms of testing? If I write a client and server program, I'd obviously want to test them in either a real or simulated network environment, but I only have one computer.

Am I missing something or is there a standard tool used for this?

Use local port for both server and clients to connect to. You can simulate multiple machines easily.

您可以尝试使用虚拟机,例如VirtualBox

如果您无法获得另一台计算机,那么我将首先使客户端和服务器都在同一台计算机上工作,并且也许最终会使用一个或多个vmware映像来进行更多模拟。

You don't need a virtual machine; you can create a virtual interface, that's much easier and won't eat half of your RAM.

http://www.lazysystemadmin.com/2010/05/add-virtual-interfaces-in-linux-quick.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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