while(true){ socket = serverSocket.accept(); ServerThread serverthread = new ServerThread(socket); serverthread.start(); i++; System.out.print("客户端的数量:"+i+"-------"); InetAddress address = socket.getInetAddress(); System.out.println("客户端的IP地址:"+address.getHostAddress()); }
----服务器即将启动,等待客户端的链接----
客户端的数量:1-------客户端的IP地址:127.0.0.1
我是服务器,客户端说:用户名:tom;密码 : 456
相关分类