BF2Statistics.Gamespy.Net.GamespyTcpSocket.ShutdownSocket C# (CSharp) Method

ShutdownSocket() protected method

When called, this method will stop accepting new clients, and stop all I/O ops on all connections. Dispose still needs to be called afterwards!
protected ShutdownSocket ( ) : void
return void
        protected void ShutdownSocket()
        {
            // Only do this once
            if (!IsListening) return;
            IsListening = false;

            // Stop accepting connections
            try {
                Listener.Shutdown(SocketShutdown.Both);
            }
            catch { }
            
            // Close the listener
            Listener.Close();
        }