Java 网络编程基本步骤

JAVA 阻塞网络编程基本步骤

1. 客户端

//客户端基本步骤
Socket socket= new Socket("127.0.0.1",80);
socket.getOutputStream();
socket.close();

2. 服务端

//服务端基本步骤
ServerSocket ssocket =new ServerSocket(80);
Socket socket1 =ssocket.accept();
socket1.getInputStream();
socket1.close();
ssocket.close();

 

posted @ 2019-07-10 15:47  窦婴  阅读(310)  评论(0编辑  收藏  举报