Created
September 4, 2019 06:06
-
-
Save livepo/e51d88d3f32c15ace3503ff1d152d3ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. close会关闭连接, 并释放所有的连接对应的资源,而shutdown并不会释放掉套接字和所有的资源。 | |
2. close存在一个引用计数的概念,并不一定导致该套接字不可用;shutdown则不管引用计数,直接使得该套接字不可用,如果有别的进程企图使用该套接字,将会受到影响 | |
3. close的引用计数导致不一定会发出FIN结束报文,而shutdown则总会发出FIN结束报文,这在我们打算关闭连接通知对端的时间,是非常重要的。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment