wireshark 三次握手
阿新 • • 發佈:2017-05-11
nbsp 過濾 服務器 null tcp content image -- not found
wireshark 三次握手簡介
192.168.18.120 IP地址為我的本機虛擬機IP地址
過濾設置:ip.addr == 192.168.18.120 (ip.addr == 192.168.18.120 顯示所有目標或源地址是192.168.18.120的數據包)
第一次握手
第二次握手
第三次握手
觀察其中紅色方框內的3條數據包就是一次TCP建立連接的過程
[1]客戶端首先向服務器發一個數據包syn位置1,5774->80,嘿,哥們兒,您我想訪問你的web資源,能不能把你的80端口打開, 【73--->120】
[2]服務器向客戶端返回一個數據包syn位置1,ack位置1,80->5774,可以啊,我已經把80端口打開了,但是為了保證待會兒可靠傳輸,你也把你的5774端口打開唄,【120--->73】
[3]最後,客戶端會再向服務器端發送一個數據包ack位置1,5774->80,沒問題我也把的5774端口打開了,好的到此一次TCP連接就此建立,【73--->120】
開始測試,以下為抓取的數據包
請求數據分析
服務器響應結果分析
以上這個什麽啥意思?
短連接測試代碼
# test_redis_long location /test_redis_short { default_type ‘text/html‘; content_by_lua_file "/mnt/hgfs/Linux-Share/Lua/lua_project_v0.01/application/redis/test_short.lua"; }
test_short.lua
--[[----------------------------------------------------------------------- * | Copyright (C) Shaobo Wan (Tinywan) * | Github: https://github.com/Tinywan * | Author: Tinywan * | Date: 2017/5/8 16:25 * | Mail: [email protected] * |------------------------------------------------------------------------ * | version: 1.0 * | description: redis 短連接測試 * |------------------------------------------------------------------------ --]] local redis = require "resty.redis" local red = redis:new() local ok, err = red:connect("127.0.0.1", 63700) if not ok then ngx.say("failed to connect: ", err) return end local res, err = red:auth("tinywan123456") if not res then ngx.say("failed to authenticate: ", err) return end ok, err = red:set("redis_test_short", "redis_test_short"..ngx.time()) if not ok then ngx.say("failed to set dog: ", err) return end ngx.say("Tinywan redis_test_short set result: ", ok) local res, err = red:get("redis_test_short") if not res then ngx.say("failed to get dog: ", err) return end if res == ngx.null then ngx.say("dog not found.") return end ngx.say("redis_test_short result: ", res)
wireshark 三次握手