• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SocketShutdown类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InternalShutdown

		// don't change for default, otherwise breaking change

		// this version does not throw.
		internal void InternalShutdown (SocketShutdown how)
		{
			if (!is_connected || is_disposed)
				return;
			int error;
			Shutdown_internal (safe_handle, how, out error);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:10,代码来源:Socket.cs


示例2: InternalShutdown

		// don't change for default, otherwise breaking change

		// this version does not throw.
		internal void InternalShutdown (SocketShutdown how)
		{
			if (!connected || disposed)
				return;
			int error;
			Shutdown_internal (socket, how, out error);
		}
开发者ID:kumpera,项目名称:mono,代码行数:10,代码来源:Socket.cs


示例3: InternalShutdown

		// don't change for default, otherwise breaking change

		// this version does not throw.
		internal void InternalShutdown (SocketShutdown how)
		{
			if (!is_connected || CleanedUp)
				return;
			int error;
			Shutdown_internal (m_Handle, how, out error);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:10,代码来源:Socket.cs


示例4: Shutdown

 internal static Error Shutdown(SafeHandle socket, SocketShutdown how)
 {
     bool release = false;
     try
     {
         socket.DangerousAddRef(ref release);
         return DangerousShutdown((int)socket.DangerousGetHandle(), how);
     }
     finally
     {
         if (release)
         {
             socket.DangerousRelease();
         }
     }
 }
开发者ID:benpye,项目名称:corefx,代码行数:16,代码来源:Interop.Shutdown.cs


示例5: Shutdown_internal

		internal extern static void Shutdown_internal (IntPtr socket, SocketShutdown how, out int error);
开发者ID:Profit0004,项目名称:mono,代码行数:1,代码来源:Socket.cs


示例6: Shutdown

		public void Shutdown (SocketShutdown how)
		{
			ThrowIfDisposedAndClosed ();

			if (!is_connected)
				throw new SocketException (10057); // Not connected

			int error;
			Shutdown_internal (safe_handle, how, out error);

			if (error != 0)
				throw new SocketException (error);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:Socket.cs


示例7: 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


示例8: Shutdown

		public void Shutdown (SocketShutdown how)
		{
			if (disposed && closed)
				throw new ObjectDisposedException (GetType ().ToString ());

			if (!connected)
				throw new SocketException (10057); // Not connected

			int error;
			
			Shutdown_internal (socket, how, out error);
			if (error != 0)
				throw new SocketException (error);
		}
开发者ID:telurmasin,项目名称:mono,代码行数:14,代码来源:Socket_2_1.cs


示例9: SafeSetSocketTimeout

        private void SafeSetSocketTimeout(SocketShutdown mode) {

            if(Eof){
                return;
            }

            int timeout;
            if (mode == SocketShutdown.Receive) {
                timeout = ReadTimeout;
            } else /*if (mode == SocketShutdown.Send)*/ {
                timeout = WriteTimeout;
            }
            Connection connection = m_Connection;
            if (connection!=null) {
                NetworkStream networkStream = connection.NetworkStream;
                if (networkStream!=null) {
                    networkStream.SetSocketTimeoutOption(mode, timeout, false);
                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:20,代码来源:_ConnectStream.cs


示例10: SetSocketTimeoutOption

        internal void SetSocketTimeoutOption(SocketShutdown mode, int timeout, bool silent) {
            GlobalLog.Print("NetworkStream#" + ValidationHelper.HashString(this) + "::SetSocketTimeoutOption() mode:" + mode + " silent:" + silent + " timeout:" + timeout + " m_CurrentReadTimeout:" + m_CurrentReadTimeout + " m_CurrentWriteTimeout:" + m_CurrentWriteTimeout);
            GlobalLog.ThreadContract(ThreadKinds.Unknown, "NetworkStream#" + ValidationHelper.HashString(this) + "::SetSocketTimeoutOption");

            if (timeout < 0) {
                timeout = 0; // -1 becomes 0 for the winsock stack
            }

            Socket chkStreamSocket = m_StreamSocket;
            if (chkStreamSocket==null) {
                return;
            }
            if (mode==SocketShutdown.Send || mode==SocketShutdown.Both) {
                if (timeout!=m_CurrentWriteTimeout) {
                    chkStreamSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout, silent);
                    m_CurrentWriteTimeout = timeout;
                }
            }
            if (mode==SocketShutdown.Receive || mode==SocketShutdown.Both) {
                if (timeout!=m_CurrentReadTimeout) {
                    chkStreamSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout, silent);
                    m_CurrentReadTimeout = timeout;
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:NetworkStream.cs


示例11: Shutdown

 public void Shutdown(SocketShutdown type)
 {
     Connection.Shutdown(type);
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:4,代码来源:WinSocket.cs


示例12: SafeClose

 public static void SafeClose(this Socket socket, SocketShutdown down)
 {
     try
     {
         if (socket != null && socket.Connected)
         {
             socket.Shutdown(down);
             socket.Close();
         }
     }
     catch { }
 }
开发者ID:abel,项目名称:sinan,代码行数:12,代码来源:IPHelper.cs


示例13: ShutdownSocket

        /// <summary>
        /// Shuts down the socket.
        /// </summary>
        /// <param name="how">One of the <see cref="SocketShutdown"/> values that specifies the operation that will no longer be allowed.</param>
        private void ShutdownSocket(SocketShutdown how)
        {
#if DEBUG_GERT
            Console.WriteLine("ID: " + Thread.CurrentThread.ManagedThreadId + " | ChannelForwardedTcpip.ShutdownSocket");
#endif // DEBUG_GERT

            if (_socket == null || !_socket.Connected)
                return;

            lock (_socketShutdownAndCloseLock)
            {
                var socket = _socket;
                if (socket == null || !socket.Connected)
                    return;

                socket.Shutdown(how);
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:22,代码来源:ChannelForwardedTcpip.cs


示例14: Shutdown

 public void Shutdown(SocketShutdown how)
 {
     _remote.Shutdown(how);
 }
开发者ID:Ju2ender,项目名称:csharp-e,代码行数:4,代码来源:DirectConnect.cs


示例15: Shutdown

        public static SocketError Shutdown(SafeCloseSocket handle, bool isConnected, bool isDisconnected, SocketShutdown how)
        {
            SocketError err = Interop.Winsock.shutdown(handle, (int)how);
            if (err != SocketError.SocketError)
            {
                return SocketError.Success;
            }

            err = GetLastSocketError();
            Debug.Assert(err != SocketError.NotConnected || (!isConnected && !isDisconnected));
            return err;
        }
开发者ID:vbouret,项目名称:corefx,代码行数:12,代码来源:SocketPal.Windows.cs


示例16: 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


示例17: GetPlatformSocketShutdown

        public static int GetPlatformSocketShutdown(SocketShutdown how)
        {
            switch (how)
            {
                case SocketShutdown.Receive:
                    return Interop.libc.SHUT_RD;

                case SocketShutdown.Send:
                    return Interop.libc.SHUT_WR;

                case SocketShutdown.Both:
                    return Interop.libc.SHUT_RDWR;

                default:
                    // TODO: rethink this
                    return (int)how;
            }
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:18,代码来源:SocketPal.Unix.cs


示例18: ShutdownSocket

        /// <summary>
        /// Shuts down the socket.
        /// </summary>
        /// <param name="how">One of the <see cref="SocketShutdown"/> values that specifies the operation that will no longer be allowed.</param>
        private void ShutdownSocket(SocketShutdown how)
        {
            if (_socket == null)
                return;

            lock (_socketLock)
            {
                if (_socket == null || !_socket.Connected)
                    return;

                _socket.Shutdown(how);
            }
        }
开发者ID:zeevl,项目名称:Renci.SshNet,代码行数:17,代码来源:ChannelDirectTcpip.cs


示例19: Shutdown

		/// <summary>
		/// Shuts down the secure connection.
		/// </summary>
		/// <exception cref="ObjectDisposedException">SecureSocket has been closed.</exception>
		/// <exception cref="SocketException">An operating system error occurs while accessing the SecureSocket.</exception>
		/// <exception cref="SecurityException">An error occurs while shutting the secure connection down.</exception>
		public override void Shutdown(SocketShutdown how) {
			this.EndShutdown(this.BeginShutdown(null, null));
		}
开发者ID:JnS-Software-LLC,项目名称:iiop-net,代码行数:9,代码来源:SecureSocket.cs


示例20: Shutdown

 internal static extern Error Shutdown(int socket, SocketShutdown how);
开发者ID:noahfalk,项目名称:corefx,代码行数:1,代码来源:Interop.Shutdown.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SocketState类代码示例发布时间:2022-05-24
下一篇:
C# SocketServer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap