日期:2014-05-20 浏览次数:20703 次
Socket soc1 = new Socket(); Socket soc2 = new Socket(); soc1.connect(new InetSocketAddress("localhost", 6868), 20000); soc2.connect(new InetSocketAddress("localhost", 6868), 20000); System.out.println(soc1); System.out.println(soc2); System.out.println([color=#FF0000]soc1.getInetAddress().equals(soc2.getInetAddress()) && soc1.getPort() == soc2.getPort()[/color]); System.out.println(soc1.getInetAddress().toString() + " " + soc2.getInetAddress().toString() + "---" + soc1.getPort() + " " + soc2.getPort()); System.out.println(soc1.equals(soc2));