基于TCP的通信-2·在本地机器上测试网络程序用回送地址Socket socket=new Socket("127.0.0.1",2525);·如果网络的一端已经关闭,另一端读到null·建立socket连接后,还应该建立输入输出数据流16
16 基于TCP的通信-2 • 在本地机器上测试网络程序用回送地址 Socket socket=new Socket(“127.0.0.1”,2525); • 如果网络的一端已经关闭,另一端读到null. • 建立socket连接后,还应该建立输入输出数据 流
基于TCP的通信-3ServerClientServerSocket(port #)Socket(host, port #)Server Socket.acceptOAttempt the connectionSocketOOutputStreamOutputStreamInputStreamInputStreamClose SocketClose Socket17
17 基于TCP的通信-3 Server ServerSocket(port #) Server Socket.accept() Socket() OutputStream InputStream Close Socket Client Socket(host, port #) Attempt the connection OutputStream InputStream Close Socket