通过nc命令模拟客户端或服务器端程序

安装

brew install nc

启动服务端(8001为端口号)

nc -l 8001

启动客户端

nc 127.0.0.1 8001

浏览器访问
http://127.0.0.1:8001/

给浏览器回信

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Connection: close

hello

猜你喜欢

转载自blog.csdn.net/mouday/article/details/80982486