/// <summary> /// Closes the listening socket immediately and frees all resources. /// </summary> /// <remarks> /// <para>No events will be raised once this method is called.</para> /// </remarks> public void Close() { // Do nothing if the underlying socket isn't there. if (Socket_ == null) { return; } // Disconnect all socket events Socket_.AcceptCompleted = null; // Close the socket Socket_.Dispose(); Socket_ = null; }
/// <summary> /// Closes the listening socket immediately and frees all resources. /// </summary> /// <remarks> /// <para>No events will be raised once this method is called.</para> /// </remarks> public void Close() { // Do nothing if the underlying socket isn't there. if (Socket_ == null) return; // Disconnect all socket events Socket_.AcceptCompleted = null; // Close the socket Socket_.Dispose(); Socket_ = null; }