telnet某端口
>telnet
>open 127.0.0.1 8080
or
telnet 127.0.0.1 8080
上述两个操作一致
telnet http请求
bogon:~ $ telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /spring-tomcat/keepalive HTTP/1.1
Host: 127.0.0.1:8080
HTTP/1.1 200
Content-Type: text/plain;charset=UTF-8
Content-Length: 10
Date: Tue, 30 Jun 2020 06:54:08 GMT
- 由于header与body间存在空行,所以Host下需要加上空行,response同理
- tcp连接断开 telnet即退出
- tcp断开的原因
- 客户关闭
- 到达服务端设置的超时时间,或 请求次数
KeepAliveTimeout
,MaxKeepAliveRequests
,ConnectionTimeout
- telnet中一行行的贴入下列内容,则会发送3个tcp报文,最后一个是换行
GET /spring-tomcat/keepalive HTTP/1.1
Host: 127.0.0.1:8080