/// <summary>Closes this socket, rendering it unusable. Equivalent to calling <see cref="Dispose()"/>.</summary>
        public void Close()
        {
            #if NETSTANDARD2_0 || NET47
            if (m_runtime != null)
            {
                m_runtime.Remove(this);
                m_runtime = null;
            }
            #endif

            if (Interlocked.CompareExchange(ref m_isClosed, 1, 0) != 0)
            {
                return;
            }

            m_socketHandle.CheckDisposed();

            m_socketHandle.Close();
        }
Beispiel #2
0
 internal void DetachFromRuntime()
 {
     m_runtime = null;
 }