Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP/IP协议 #77

Open
hushicai opened this issue Sep 11, 2019 · 2 comments
Open

TCP/IP协议 #77

hushicai opened this issue Sep 11, 2019 · 2 comments

Comments

@hushicai
Copy link
Owner

No description provided.

@hushicai
Copy link
Owner Author

hushicai commented Sep 11, 2019

TCP建立连接为什么要三次握手

TCP建立连接时三次握手是为了保证客户端和服务端的读写功能都正常。

image

(图片来源https://juejin.im/post/5c666bcff265da2dcf626fd8)

@hushicai
Copy link
Owner Author

hushicai commented Sep 11, 2019

TCP断开连接为什么要四次挥手

当客户端发起断开连接的请求FIN,即第一次挥手,代表客户端不会再发送其他数据给服务端,服务端会立即返回一个响应值为ack=seq+1的数据,但是服务端可能还有数据没有传输完,所以要等传输完以后再发送一个新的序列号为y的数据包给客户端,客户端接收到了这个新包以后继续发送一个响应值为y+1的包给服务端,当服务端接收到该包以后双方才会真正关闭连接。

image

(图片来源https://juejin.im/post/5c666bcff265da2dcf626fd8)

@hushicai hushicai changed the title 网络编程 TCP/IP协议 Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant