-
Graceful Shutdown, Linger Options, and Socket Closure프로그래밍 2021. 1. 3. 00:55반응형
Graceful Shutdown, Linger Options, and Socket Closure - Win32 apps | Microsoft Docs
Shutting down a socket connection involves an exchange of protocol messages between the two endpoints, hereafter referred to as a shutdown sequence. Two general classes of shutdown sequences are defined: graceful and abortive (also called hard). In a graceful shutdown sequence, any data that has been queued, but not yet transmitted can be sent prior to the connection being closed. In an abortive shutdown, any unsent data is lost. The occurrence of a shutdown sequence (graceful or abortive) can also be used to provide an FD_CLOSE indication to the associated applications signifying that a shutdown is in progress.
Closing a socket, on the other hand, causes the socket handle to become deallocated so that the application can no longer reference or use the socket in any manner.
One technique that can be used to minimize the chance of problems occurring during connection teardown is to avoid relying on an implicit shutdown being initiated by closesocket. Instead, use one of the two explicit shutdown functions, shutdown or WSASendDisconnect. This in turn causes an FD_CLOSE indication to be received by the peer application indicating that all pending data has been received.
반응형'프로그래밍' 카테고리의 다른 글
러스트를 배워보는 중 (0) 2023.09.10 Visual Studio 단축키 (0) 2020.11.30 Visual Studio 에서 솔루션 프로젝트 프로그램 여러 개 띄우기 (0) 2020.11.10 터미널(콘솔) 출력 메세지들 파일에 저장하기 (0) 2019.04.06 Viasfora 플러그인 - 비주얼 스튜디오에서 코드를 알록달록하게! (0) 2019.03.01