new'
ServerSocket(8080)
Socket socket
=serverSocket
.accept()
(read
/write阻塞
)
BufferReader buffer
=new BufferReader(new inputStreamReader(socket
.getInputStream
)));
buffer
.readLine();
客户端
Socket socket
=new Socket("localhost" ,8080);
PrintWriter out
=new PrintWriter(socket
.getOutPutStream(),true)
out
.println("111");
BIO模型
连接阻塞
accept()
IO阻塞 BufferReader buffer=new BufferReader(new inputStreamReader(socket.getInputStream)));
非阻塞
Netty
转载请注明原文地址:https://ipadbbs.8miu.com/read-938.html