System.Net.Sockets.Socket.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
            if (NetEventSource.IsEnabled)
            {
                NetEventSource.Info(this, $"timeout = {_closeTimeout}");
                NetEventSource.Enter(this);
            }
            Dispose(true);
            GC.SuppressFinalize(this);
            if (NetEventSource.IsEnabled) NetEventSource.Exit(this);
        }

Same methods

Socket::Dispose ( bool disposing ) : void

Usage Example

Example #1
0
        /// <summary>
        /// 停止服务
        /// </summary>
        public void Dispose()
        {
            if (socket != null)
            {
#if DotNetStandard
                AutoCSer.Net.TcpServer.CommandBase.CloseServer(socket);
#else
                socket.Dispose();
#endif
                socket = null;
            }
        }
All Usage Examples Of System.Net.Sockets.Socket::Dispose