TCP,UDP,http

1,区别

udp:

a、是面向无连接, 将数据及源的封装成数据包中,不需要建立连接

b、每个数据报的大小在限制64k内

c、因无连接,是不可靠协议

d、不需要建立连接,速度快

tcp:

a、建议连接,形成传输数据的通道.

b、在连接中进行大数据量传输,以字节流方式

c 通过三次握手完成连接,是可靠协议

d 必须建立连接m效率会稍低

 

2,Http协议组成部分

http协议基于TCP协议封装成超文本传输协议,http分为请求与响应,http协议分为请求参数和方法类型、请求头、请求体,响应分为 响应状态、响应头、响应体等。

下面是一个HTTP 请求的报文:

General:
Request URL: https://www.baidu.com/s?cl=3&tn=baidutop10&fr=top1000&wd=%E4%B8%AD%E5%9B%BD%E5%A0%B5%E5%9F%8E%E6%8E%92%E8%A1%8C%E6%A6%9C&rsv_idx=2&rsv_dl=fyb_n_homepage
Request Method: GET
Status Code: 200 OK
Remote Address: 39.156.66.14:443
Referrer Policy: unsafe-url

Response Headers:
Bdpagetype: 3
Bdqid: 0x983ae11a001cabca
Cache-Control: private
Ckpacknum: 2
Ckrndstr: a001cabca
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/html;charset=utf-8
Date: Tue, 23 Jul 2019 05:48:03 GMT
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Server: BWS/1.1
Set-Cookie: BDRCVFR[S4-dAuiWMmn]=I67x6TjHwwYf0; path=/; domain=.baidu.com
Set-Cookie: delPer=0; path=/; domain=.baidu.com
Set-Cookie: BD_CK_SAM=1;path=/
Set-Cookie: PSINO=1; domain=.baidu.com; path=/
Set-Cookie: BDSVRTM=23; path=/
Set-Cookie: H_PS_PSSID=1444_21107_29579_20697_29522_29519_28518_29098_29568_28838_29220_26350_29071; path=/; domain=.baidu.com
Strict-Transport-Security: max-age=172800
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Ua-Compatible: IE=Edge,chrome=1


Request Headers:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cache-Control: max-age=0
Connection: keep-alive
Cookie: BAIDU_SSP_lcr=https://blog.csdn.net/changej/article/details/86648064; BAIDUID=F6757F58497533FB35F03C58F4B3FACB:FG=1; BIDUPSID=F6757F58497533FB35F03C58F4B3FACB; PSTM=1541679807; BDUSS=kNxUFVkbEVJWE5zQ2VhOXQ3aGZrNFpiQUk2T1M3MGNqcGFxMFNhY1B0UGNYY1pjQVFBQUFBJCQAAAAAAAAAAAEAAAB9G2YvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANzQnlzc0J5cc; BD_UPN=12314753; BDSFRCVID=e24OJeC62m6o96Rw-OdZMBPpacRsFbQTH6aorZO22Hsc2G7-SLGdEG0PeU8g0Kubo7k0ogKK0eOTHkCF_2uxOjjg8UtVJeC6EG0P3J; H_BDCLCKID_SF=JJkO_D_atKvjDbTnMITHh-F-5fIX5-RLfaCjM-OF5lOTJh0RQh5ZXnbD5bjiexuJB67D0tJLb4DaStJbLjbke6jLjaLttTLqfK6jQTr2KRrbHJuk-PnVePCnLtnZKxtqtjrCXJ5IWt0VOxt6Xf5mK-_s2a5wt-JnWnFj_RuK3qR-sbTP24CBL6LzyNo405OT-GIO0KJcbRoRoqRKhPJvyT88XnO7aMJlXbrtXp7_2J0WStbKy4oTjxL1Db0eBjIDJbKfoILhfCvjDbTnMITHh-F-5fIX5-RLfakJLp7F5l8-hCQ1Lj7WhnbDbG_H-MCq-GueKM_hJq7xOKQphPbkb4tfLxJN0pjyLCJ2WJ5N3KJmeqC9bT3v5tDZyHKL2-biWbR-2Mbd2hOP_IoG2Mn8M4bb3qOpBtQmJeTxoUtbWDFaMII6D5DaejPShMr2aK6KaI58LRu8Kb7VbnRYjMnkbfJBDlJCJ6OQQTkL0qbsBlomqbj2W45pKlD7yajK2KrnBDQhab0K2M3soCjH-4QpQT8ry-FOK5OibCrpaC_Eab3vOIJNXpO1MUtzBN5thURB2DkO-4bCWJ5TMl5jDh05y6TLea_8JTLDfR32Wn7a5TrMeJrnbtTMq4tehHRrLpR9WDTm_D_2JJoDDK56qJLMKxuY0h3KKhJOKe32-pPKKR7zSbFxQJ60hpKb3N-e-Mkf3mkjbn5Dfn02OP5PhTJOD-4syP4jKxRnWI3mKfA-b4ncjRcTehoM3xI8LNj405OTt2LEoCPafCthhDIr-Pvo5t3H5MoX5-QXbPo2WbCQ5C_M8pcNLTDKhjKeeHjN-Kr95NQu5fJMKROCqpQP0qO1j4_eKR69Jjj7-KAHKK0ELhRneh5jDh3q3jksD-Rt5t4f2bRy0hvctn5cShncLUjrDRLbXU6BK5vPbNcZ0l8K3l02VKO_e4bK-Tr-jNL83J; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BD_CK_SAM=1; PSINO=1; delPer=0; BD_HOME=1; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; COOKIE_SESSION=232_0_3_3_1_1_0_0_3_1_14_0_0_0_0_0_1563860565_0_1563860798%7C3%230_0_1563860798%7C1; BDRCVFR[S4-dAuiWMmn]=I67x6TjHwwYf0; H_PS_PSSID=1444_21107_29579_20697_29522_29519_28518_29098_29568_28838_29220_26350_29071; H_PS_645EC=dd8d1INNnZwXfvmR4ttSQEOq4ywjsxxTbU0uY%2F%2Bxsod6yO94iI5KwOFojHw%2BIRLNXA
Host: www.baidu.com
Referer: https://www.baidu.com/
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Query String Parameters
cl: 3
tn: baidutop10
fr: top1000
wd: 中国堵城排行榜
rsv_idx: 2
rsv_dl: fyb_n_homepage

 

General: 一般包括请求的url,请求的方式,状态码,代理服务器的ip

Request Headers: 包括请求头,请求体,包含host,浏览器信息,语言,encoding

posted @ 2019-07-23 13:37  Chris,Cai  阅读(911)  评论(0编辑  收藏  举报