コード例 #1
0
        /// <summary>
        /// Closes the listen socket and all active connections without a proper goodbye.
        /// </summary>
        public virtual void Stop()
        {
            IsRunning = false;

            if (tcpListenSocket != null && tcpListenSocket.IsBound)
            {
                tcpListenSocket.Close();
            }
            if (unixListenSocket != null && unixListenSocket.IsBound)
            {
                unixListenSocket.Close();
                System.IO.File.Delete(unixSocketFilePath);
            }

            //TODO: Stop task that waits for connection data..
            if (Logger != null)
            {
                Logger.ServerStop();
            }

            foreach (var socketAndRequest in OpenSockets)
            {
                socketAndRequest.Value.Dispose();
            }
        }