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


C# DisconnectReason类代码示例

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


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

示例1: OnDisconnect

        protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
        {
            var remoteAddress = this.RemoteIP + ":" + this.RemotePort;
            PhotonWireApplicationBase.Instance.Logger.InboundPeerOnDisconnect(PhotonWireApplicationBase.Instance.ApplicationName, remoteAddress, this.ConnectionId, reasonCode.ToString(), reasonDetail);

            PeerManager.InboundServerConnections.Remove(this);
            List<Exception> exceptions = new List<Exception>();
            Action<int, string>[] copy;
            lock (disconnectActions)
            {
                if (disconnectActions.Count == 0) return;
                copy = new Action<int, string>[disconnectActions.Count];
                disconnectActions.CopyTo(copy);
            }

            foreach (var item in copy)
            {
                try
                {
                    item((int)reasonCode, reasonDetail);
                }
                catch (Exception ex)
                {
                    exceptions.Add(ex);
                }
            }
            if (exceptions.Count > 0)
            {
                throw new AggregateException(exceptions);
            }
        }
开发者ID:neuecc,项目名称:PhotonWire,代码行数:31,代码来源:PhotonWireInboundS2SPeer.cs

示例2: OnDisconnect

 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     lock (StarCollectorGame.Instance)
     {
         StarCollectorGame.Instance.PeerLeft(this);
     }
 }
开发者ID:anhle128,项目名称:demo_photon_with_unity,代码行数:7,代码来源:StarCollectorPeer.cs

示例3: DisconnectMessageConstructorTest1

 public void DisconnectMessageConstructorTest1()
 {
     DisconnectReason reasonCode = new DisconnectReason(); // TODO: Initialize to an appropriate value
     string message = string.Empty; // TODO: Initialize to an appropriate value
     DisconnectMessage target = new DisconnectMessage(reasonCode, message);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:7,代码来源:DisconnectMessageTest.cs

示例4: SshConnectionExceptionConstructorTest2

 public void SshConnectionExceptionConstructorTest2()
 {
     string message = string.Empty; // TODO: Initialize to an appropriate value
     DisconnectReason disconnectReasonCode = new DisconnectReason(); // TODO: Initialize to an appropriate value
     SshConnectionException target = new SshConnectionException(message, disconnectReasonCode);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
开发者ID:delfinof,项目名称:ssh.net,代码行数:7,代码来源:SshConnectionExceptionTest.cs

示例5: CloseConnection

        private void CloseConnection(bool force, DisconnectReason reason, int socketErrorCode)
        {
            lock (_connectionCloseLock)
            {
                //Nothing to do
                if (!IsRunning)
                    return;

                //Send goodbye
                if (_peer != null && !force && _connected)
                {
                    //Send disconnect data
                    var disconnectPacket = NetPacket.CreateRawPacket(PacketProperty.Disconnect, 8);
                    FastBitConverter.GetBytes(disconnectPacket, 1, _connectId);
                    SendRaw(disconnectPacket, _peer.EndPoint);
                }

                //Clear data
                _peer = null;
                _connected = false;
                _connectTimer = 0;
                _connectAttempts = 0;
                SocketClearPeers();

                //Send event to Listener
                var netEvent = CreateEvent(NetEventType.Disconnect);
                netEvent.DisconnectReason = reason;
                netEvent.AdditionalData = socketErrorCode;
                EnqueueEvent(netEvent);
            }
        }
开发者ID:RevenantX,项目名称:LiteNetLib,代码行数:31,代码来源:NetClient.cs

示例6: OnDisconnect

 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     if (log.IsDebugEnabled)
     {
         log.DebugFormat("Latency monitoring client disconnected: reason={0}, detail{1}", reasonCode, reasonDetail);
     }
 }
开发者ID:JerryBian,项目名称:PhotonSample,代码行数:7,代码来源:LatencyPeer.cs

示例7: OnDisconnect

 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     lock (syncRoot)
     {
         BroadcastMessage -= this.OnBroadcastMessage;
     }
 }
开发者ID:rkdrnf,项目名称:photonserver,代码行数:7,代码来源:ChatPeer.cs

示例8: OnDisconnect

 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     lock (ServerArena.Instance)
     {
         ServerArena.Instance.Exit(this);
     }
 }
开发者ID:anhle128,项目名称:demo_photon_with_unity,代码行数:7,代码来源:ActorPeer.cs

示例9: OnDisconnect

 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     World.Instance.RemoveClient(this);
     var sendParameters = new SendParameters();
     sendParameters.Unreliable = true;
     WorldExitHandler(sendParameters);
     Log.Debug("Disconnected!");
 }
开发者ID:nPaul,项目名称:TestPhotonLib,代码行数:8,代码来源:UnityClient.cs

示例10: IsDefined

 public static bool IsDefined(DisconnectReason value)
 {
     if ((((value != DisconnectReason.LeavingMesh) && (value != DisconnectReason.NotUsefulNeighbor)) && ((value != DisconnectReason.DuplicateNeighbor) && (value != DisconnectReason.DuplicateNodeId))) && (value != DisconnectReason.NodeBusy))
     {
         return (value == DisconnectReason.InternalFailure);
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:PeerConnectorHelper.cs

示例11: DisconnectMessage

        /// <summary>
        /// Initializes a new instance of the <see cref="DisconnectMessage"/> class.
        /// </summary>
        /// <param name="reasonCode">The reason code.</param>
        /// <param name="message">The message.</param>
        public DisconnectMessage(DisconnectReason reasonCode, string message)
        {
            ReasonCode = reasonCode;
            Description = message;
#if TUNING
            Language = "en";
#endif
        }
开发者ID:delfinof,项目名称:ssh.net,代码行数:13,代码来源:DisconnectMessage.cs

示例12: DisconnectMessage

        public DisconnectMessage(DisconnectReason reasonCode, string description = "", string language = "en")
        {
            Contract.Requires(description != null);
            Contract.Requires(language != null);

            ReasonCode = reasonCode;
            Description = description;
            Language = language;
        }
开发者ID:jinhang2008,项目名称:FxSsh,代码行数:9,代码来源:DisconnectMessage.cs

示例13: OnDisconnectStatic

 public static bool OnDisconnectStatic(DisconnectReason reason, string message)
 {
     if (Settings.AutoRelog_Enabled)
     {
         AutoRelog bot = new AutoRelog(Settings.AutoRelog_Delay, Settings.AutoRelog_Retries);
         return bot.OnDisconnect(reason, message);
     }
     return false;
 }
开发者ID:gdianaty,项目名称:MinechatPC,代码行数:9,代码来源:AutoRelog.cs

示例14: OnDisconnect

		/// <summary>
		/// Called when Photon internally disconnects the peer.
		/// </summary>
		/// <param name="reasonCode">Reason for disconnecting.</param>
		/// <param name="reasonDetail">Detailed reason string.</param>
		protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
		{
			//Null the peer out otherwise we will leak. Trust me.
			GladNetPeer = null;

			//Disconnects the peer
			disconnectionServiceHandler.Disconnect();

			networkReciever.OnNetworkMessageReceive(new PhotonStatusMessageAdapter(NetStatus.Disconnected), null);
		}
开发者ID:HelloKitty,项目名称:GladNet.PhotonServer,代码行数:15,代码来源:GladNetOutboundS2SPeer.cs

示例15: MasterEmulator

        //, own_address=None, bond_info=None):
        public MasterEmulator( String peer_device_address, Int32 baud_rate=1000000 )
        {
            this.peer_device_address = peer_device_address;

            this.num_of_errors = 0;
            //logger = TimestampLogger();
            this.connected = false;
            this.disconnect_event_expected = true;
            this.service_setup_done = true;
            this.last_disconnect_reason = DisconnectReason.UnspecifiedError; // = -1;

            this.baud_rate = baud_rate;

            //this.own_address = own_address;
            //this.bond_info = bond_info;
        }
开发者ID:Stupid-Git,项目名称:td_nRF_dfu,代码行数:17,代码来源:master_emulator.cs


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