protected override bool ReleaseHandle()
        {
            SafeCloseSocket socket = this._socketHandle;

            if ((socket != null) && !socket.IsInvalid)
            {
                socket.Dispose();
            }
            return(UnsafeNclNativeMethods.SafeNetHandles.LocalFree(base.handle) == IntPtr.Zero);
        }
        unsafe override protected bool ReleaseHandle()
        {
            SafeCloseSocket socketHandle = _socketHandle;

            if (socketHandle != null && !socketHandle.IsInvalid)
            {
                // We are being finalized while the I/O operation associated
                // with the current overlapped is still pending (e.g. on app
                // domain shutdown). The socket has to be closed first to
                // avoid reuse after delete of the native overlapped structure.
                socketHandle.Dispose();
            }
            // Release the native overlapped structure
            return(UnsafeNclNativeMethods.SafeNetHandles.LocalFree(handle) == IntPtr.Zero);
        }