分布计算 a Socket programming in Java // listen to port 5000 on the local host for socket connection requests ServerSocket s new Server Socket(5000)i while (true )( // wait for connection request from client Socket clientconn s accepto) Inputstream in clientconn. getInputstream()i Outputstream out s clientConn. getoutputstream()i // now IO streams are connected to client: do something with them Institute of Computer Software 2021/2/517 Nanjing University分布计算 Socket programming in Java 2021/2/5 Institute of Computer Software Nanjing University 17 17 // listen to port 5000 on the local host for socket connection requests ServerSocket s = new ServerSocket(5000); while (true) { // wait for connection request from client Socket clientConn = s.accept(); InputStream in = clientConn.getInputStream(); OutputStream out = clientConn.getOutputStream(); // now IO streams are connected to client; do something with them