远程升级准备工作: 使用TCP客户端连接Web服务器实现http下载数据

https://www.cnblogs.com/yangfengwu/p/11640870.html

一,根目录建一个文件

二,使用浏览器访问

http://47.92.31.46:80/1.txt     或者  http://47.92.31.46/1.txt

三,使用TCP客户端访问文件内容

  3.1,使用TCP客户端连接服务器,IP/域名  端口号:80

  

  3.2,发送http协议

  GET+空格+/文件路径+空格+HTTP/1.1

  Host:+空格+IP/域名

  两个换行到这里

  

GET /1.txt HTTP/1.1
Host: 47.92.31.46


  

  

  连接以后发送以上数据

  数据返回

  

   

12:17:21 发送数据:GET /1.txt HTTP/1.1
Host: 47.92.31.46

[1次]
12:17:21 收到数据:HTTP/1.1 200 OK
Server: openresty/1.15.8.2
Date: Wed, 09 Oct 2019 04:17:20 GMT
Content-Type: text/plain
Content-Length: 10
Last-Modified: Wed, 09 Oct 2019 04:01:46 GMT
Connection: keep-alive
ETag: "5d9d5baa-a"
Accept-Ranges: bytes

1234567890

猜你喜欢

转载自www.cnblogs.com/yangfengwu/p/11641008.html