[Java] Linux command to get Baidu's homepage-simulate Socket three-way handshake

Insert picture description here

1 Overview

Video: Bilibili Socket three-way handshake

[lcc@lcc ~/soft/zookeeper/zookeeper-3.4.12]$ exec 9<> /dev/tcp/www.baidu.com/80
[lcc@lcc ~/soft/zookeeper/zookeeper-3.4.12]$ echo -e "GET / HTTP/1.0\n" 1>& 9
[lcc@lcc ~/soft/zookeeper/zookeeper-3.4.12]$ cat <& 9
HTTP/1.0 200 OK
Accept-Ranges: bytes
Cache-Control: no-cache
Content-Length: 14615
Content-Type: text/html
Date: Sun, 20 Dec 2020 13:26:56 GMT
P3p: CP=" OTI DSP COR IVA OUR IND COM "
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Pragma: no-cache
Server: BWS/1.1
Set-Cookie: BAIDUID=276347DEB666BF539C806DAB1C3C3E3F:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: BIDUPSID=276347DEB666BF539C806DAB1C3C3E3F; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: PSTM=1608470816; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: BAIDUID=276347DEB666BF53997F8E0B62C9C33B:FG=1; max-age=31536000; expires=Mon, 20-Dec-21 13:26:56 GMT; domain=.baidu.com; path=/; version=1; comment=bd
Traceid: 1608470816087056743410903128078598951592
Vary: Accept-Encoding
X-Ua-Compatible: IE=Edge,chrome=1

<!DOCTYPE html><!--STATUS OK-->
<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge">
	<link rel="dns-prefetch" href="//s1.bdstatic.com"/>
	<link rel="dns-prefetch" href="//t1.baidu.com"/>
	<link rel="dns-prefetch" href="//t2.baidu.com"/>
	<link rel="dns-prefetch" href="//t3.baidu.com"/>
	<link rel="dns-prefetch" href="//t10.baidu.com"/>
	<link rel="dns-prefetch" href="//t11.baidu.com"/>
	<link rel="dns-prefetch" href="//t12.baidu.com"/>
	<link rel="dns-prefetch" href="//b1.bdstatic.com"/>
	<title>百度一下,你就知道</title>
	<link href="http://s1.bdstatic.com/r/www/cache/static/home/css/index.css" rel="stylesheet" type="text/css" />
	<!--[if lte IE 8]><style index="index" >#content{
    
    height:480px\9}#m{
    
    top:260px\9}</style><![endif]-->
	<!--[if IE 8]><style index="index" >#u1 a.mnav,#u1 a.mnav:visited{
    
    font-family:simsun}</style><![endif]-->
	<script>var hashMatch = document.location.href.match(/#+(.*w

Insert picture description here
Insert picture description here
0 represents standard input
1 represents standard output
2 represents standard error output

TCP packet capture
Insert picture description here
can also add the -X parameter to display the packet content.

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_21383435/article/details/111463123