java - using loopback for testing environment -


i want run 2 instance of same server on same physical machine. these 2 servers listen same port, 12345. trying run 1 server on 127.0.0.1, , other 1 on 127.0.0.2. these 2 servers send , receive messages using same port running on separate loopback addresses. not know if on correct path set test environment? somehow, not able setting testing environment. using java develop server.

you can bind 2 servers same port if specify 2 different interfaces:

serversocket s1 = new serversocket(port, 500, inetaddress.getbyname("127.0.0.1")); serversocket s2 = new serversocket(port, 500, inetaddress.getbyname("127.0.0.2")); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -