当前位置: 首页>>代码示例>>C#>>正文


C# SocketShutdown.ToString方法代码示例

本文整理汇总了C#中SocketShutdown.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SocketShutdown.ToString方法的具体用法?C# SocketShutdown.ToString怎么用?C# SocketShutdown.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SocketShutdown的用法示例。


在下文中一共展示了SocketShutdown.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InternalShutdown

        // This version does not throw.
        internal void InternalShutdown(SocketShutdown how)
        {
            GlobalLog.Print("Socket#" + Logging.HashString(this) + "::InternalShutdown() how:" + how.ToString());

            if (CleanedUp || _handle.IsInvalid)
            {
                return;
            }

            try
            {
                SocketPal.Shutdown(_handle, _isConnected, _isDisconnected, how);
            }
            catch (ObjectDisposedException) { }
        }
开发者ID:ReedKimble,项目名称:corefx,代码行数:16,代码来源:Socket.cs

示例2: Shutdown

        // Disables sends and receives on a socket.
        public void Shutdown(SocketShutdown how)
        {
            if (s_loggingEnabled)
            {
                Logging.Enter(Logging.Sockets, this, "Shutdown", how);
            }
            if (CleanedUp)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            GlobalLog.Print("Socket#" + Logging.HashString(this) + "::Shutdown() how:" + how.ToString());

            // This can throw ObjectDisposedException.
            SocketError errorCode = SocketPal.Shutdown(_handle, _isConnected, _isDisconnected, how);

            GlobalLog.Print("Socket#" + Logging.HashString(this) + "::Shutdown() Interop.Winsock.shutdown returns errorCode:" + errorCode);

            // Skip good cases: success, socket already closed.
            if (errorCode != SocketError.Success && errorCode != SocketError.NotSocket)
            {
                // Update the internal state of this socket according to the error before throwing.
                SocketException socketException = new SocketException((int)errorCode);
                UpdateStatusAfterSocketError(socketException);
                if (s_loggingEnabled)
                {
                    Logging.Exception(Logging.Sockets, this, "Shutdown", socketException);
                }
                throw socketException;
            }

            SetToDisconnected();
            InternalSetBlocking(_willBlockInternal);
            if (s_loggingEnabled)
            {
                Logging.Exit(Logging.Sockets, this, "Shutdown", "");
            }
        }
开发者ID:ReedKimble,项目名称:corefx,代码行数:39,代码来源:Socket.cs

示例3: InternalShutdown

        // this version does not throw.
        internal void InternalShutdown(SocketShutdown how) {
            GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::InternalShutdown() how:" + how.ToString());

            if (CleanedUp || m_Handle.IsInvalid) {
                return;
            }

            try
            {
                UnsafeNclNativeMethods.OSSOCK.shutdown(m_Handle, (int)how);
            }
            catch (ObjectDisposedException) { }
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:14,代码来源:Socket.cs

示例4: Shutdown

        /// <devdoc>
        ///    <para>
        ///       Disables sends and receives on a socket.
        ///    </para>
        /// </devdoc>
        public void Shutdown(SocketShutdown how) {
            if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Shutdown", how);
            if (CleanedUp) {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Shutdown() how:" + how.ToString());

            // This can throw ObjectDisposedException.
            SocketError errorCode = UnsafeNclNativeMethods.OSSOCK.shutdown(m_Handle, (int) how);

            //
            // if the native call fails we'll throw a SocketException
            //
            errorCode = errorCode!=SocketError.SocketError ? SocketError.Success : (SocketError)Marshal.GetLastWin32Error();

            GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Shutdown() UnsafeNclNativeMethods.OSSOCK.shutdown returns errorCode:" + errorCode);

            //
            // skip good cases: success, socket already closed
            //
            if (errorCode!=SocketError.Success && errorCode!=SocketError.NotSocket) {
                //
                // update our internal state after this socket error and throw
                //
                SocketException socketException = new SocketException(errorCode);
                UpdateStatusAfterSocketError(socketException);
                if(s_LoggingEnabled)Logging.Exception(Logging.Sockets, this, "Shutdown", socketException );
                throw socketException;
            }

            SetToDisconnected();
            InternalSetBlocking(willBlockInternal);
            if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Shutdown", "");
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:40,代码来源:Socket.cs

示例5: InternalShutdown

 // this version does not throw.
 internal void InternalShutdown(SocketShutdown how) {
     GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::InternalShutdown() how:" + how.ToString());
     if (CleanedUp || m_Handle==SocketErrors.InvalidSocketIntPtr) {
         return;
     }
     UnsafeNclNativeMethods.OSSOCK.shutdown(m_Handle, (int)how);
 }
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:socket.cs

示例6: Shutdown

        /// <include file='doc\Socket.uex' path='docs/doc[@for="Socket.Shutdown"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Disables sends and receives on a socket.
        ///    </para>
        /// </devdoc>
        public void Shutdown(SocketShutdown how) {
            if (CleanedUp) {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Shutdown() how:" + how.ToString());

            if (m_Handle==SocketErrors.InvalidSocketIntPtr) {
                //
                // oh well, we really can't do a lot here
                //
                return;
            }

            int errorCode =
                UnsafeNclNativeMethods.OSSOCK.shutdown(
                    m_Handle,
                    (int)how);

            //
            // if the native call fails we'll throw a SocketException
            //
            errorCode = errorCode!=SocketErrors.SocketError ? 0 : Marshal.GetLastWin32Error();

            GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Close() shutdown returned errorCode:" + errorCode.ToString());

            //
            // skip good cases: success, socket already closed
            //
            if (errorCode!=SocketErrors.Success && errorCode!=SocketErrors.WSAENOTSOCK) {
                //
                // update our internal state after this socket error and throw
                //
                UpdateStatusAfterSocketError();
                throw new SocketException(errorCode);
            }

            SetToDisconnected();
        }
开发者ID:ArildF,项目名称:masters,代码行数:45,代码来源:socket.cs


注:本文中的SocketShutdown.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。