You mean something like this:
Socket socket1 = new Socket(); socket1.bind(new InetSocketAddress("10.1.1.1", port)); socket1.connect(new InetSocketAddress("10.1.3.1", port)); Socket socket2 = new Socket(); socket2.bind(new InetSocketAddress("10.1.2.1", port)); socket2.connect(new InetSocketAddress("10.1.3.1", port);
source share