示例#1
0
        private void CloseClientSocket(Socket socket, SocketAsyncEventArgs args)
        {
            // Do a shutdown before you close the socket
            try
            {
                socket.Shutdown(SocketShutdown.Both);
                _protocol.Dispose(args);
            }
            catch (Exception)
            {
                // ignored
            }

            // This method closes the socket and releases all resources, both managed and unmanaged.
            socket.Close();

            _monitor.CloseClient();
        }