public static void ReadCallback(IAsyncResult ar) { String content = String.Empty; StateObject state = (StateObject)ar.AsyncState; Socket handler = state.workSocket; int bytesRead = handler.EndReceive(ar); if (bytesRead > 0) { state.sb.Append(Encoding.ASCII.GetString( state.buffer, 0, bytesRead)); content = state.sb.ToString(); if (content.IndexOf("<keep_alive>") > -1) { content = content.Replace("<keep_alive>", ""); KeepAliveMessage message = JsonConvert.DeserializeObject <KeepAliveMessage>(content); Console.WriteLine("NMS: Keep Alive - Device {0}", message.name); setDeviceActiveState(message.name, true); changeDevicePort(getPort(handler), message.name); string response = "Keep alive message received<EOF>"; Send(handler, response); } else { handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), state); } } }
public void KeepAliveExpired() { if (GlobalVariables.keepAliveExpiredCount < GlobalVariables.listnerSocket_Dictionary.Count) { if (GlobalVariables.listnerSocket_Dictionary.ContainsKey(GlobalVariables.keepAliveExpiredCount)) { Socket tempSock = GlobalVariables.listnerSocket_Dictionary[GlobalVariables.keepAliveExpiredCount]; KeepAliveMessage keepAlivePacket = new KeepAliveMessage(); messageType = "KeepAlive"; sendKeepAlive.WaitOne(); Console.WriteLine("BGP Listner:" + IPAddress.Parse(((IPEndPoint)tempSock.LocalEndPoint).Address.ToString()) + " has send keepAlive Message !!"); sendKeepAlive.Set(); SendSpeaker(keepAlivePacket.BGPmessage, tempSock, messageType); GlobalVariables.keepAliveExpiredCount++; } else { GlobalVariables.keepAliveExpiredCount++; } } else { GlobalVariables.keepAliveExpiredCount = 0; } }
public void SendingKeepAliveMsg_Speaker() { //tracking the proper connection number and the speaker socket was the difficult task if (GlobalVariables.keepAliveMsgSendCount < GlobalVariables.listnerSocket_Dictionary.Count) { //tempSocket[GlobalVariables.keepAliveMsgSendCount] = GlobalVariables.listnerSocket_Dictionary[GlobalVariables.keepAliveMsgSendCount]; Socket tempSock = GlobalVariables.listnerSocket_Dictionary[GlobalVariables.keepAliveMsgSendCount]; KeepAliveMessage keepAlivePacket = new KeepAliveMessage(); messageType = "KeepAlive"; //sendKeepAliveMessage.WaitOne(); //Socket temSoc = tempSocket[GlobalVariables.keepAliveMsgSendCount]; Console.WriteLine("BGP Listner:" + IPAddress.Parse(((IPEndPoint)tempSock.LocalEndPoint).Address.ToString()) + " has send keepAlive Message !!"); SendSpeaker(keepAlivePacket.BGPmessage, tempSock, messageType); //sendKeepAliveMessage.Set(); //sendKeepAliveDone.WaitOne(); GlobalVariables.keepAliveMsgSendCount++; } }
private async void BroadcastKeepAliveMessages(object state) { foreach (var peer in _peerTracker.GetAllTrackedPeers()) { var randomSetOfPeers = _peerTracker.GetRandomSetOfTrackedPeers(8); var keepAliveMessage = new KeepAliveMessage(_messageHeader); keepAliveMessage.Peers = randomSetOfPeers.Select(x => x.IpEndPoint).ToArray(); await _packetSender.SendPacket(keepAliveMessage, peer.IpEndPoint); } }
public async Task ZeroMessageBodyIsKeepAlive() { var buffer = new byte[4]; Message.Write(buffer, 0, 0); await NetworkIO.SendAsync(pair.Outgoing, buffer, 0, buffer.Length); Assert.IsInstanceOf <KeepAliveMessage> (await PeerIO.ReceiveMessageAsync(pair.Incoming, PlainTextEncryption.Instance)); buffer = new KeepAliveMessage().Encode(); await NetworkIO.SendAsync(pair.Outgoing, buffer, 0, buffer.Length); Assert.IsInstanceOf <KeepAliveMessage> (await PeerIO.ReceiveMessageAsync(pair.Incoming, PlainTextEncryption.Instance)); }
public void KeepAliveMessage_TryDecode() { KeepAliveMessage message; int offset = 0; byte[] data = "00000000".ToByteArray(); if (KeepAliveMessage.TryDecode(data, ref offset, out message)) { Assert.AreEqual(4, message.Length); CollectionAssert.AreEqual(data, message.Encode()); } else { Assert.Fail(); } }
public void HandlerEvent(UdpEvent udp_event) { IPEndPoint sender = udp_event.Address; if (udp_event.Message.Type != UdpMessageType.BACKUP_KEEP_ALIVE) { Logger.Warning( string.Format("Receive not keep alive message from {0}, type {1}", sender.Address.ToString(), udp_event.Message.Type)); return; } if (!this.members.Contains(sender.Address.ToString())) { Logger.Warning( string.Format("Receive keep alive message from {0} is not my member.", sender.Address.ToString())); return; } this.last_keep_alive_time = Helper.CurrentTimeMillis(); KeepAliveMessage message = (KeepAliveMessage)udp_event.Message; string ip = sender.Address.ToString(); if (this.status == BackupStatus.INIT && (message.Flag || message.Priority > this.priority)) { this.status = BackupStatus.SLAVER; return; } if (this.status == BackupStatus.MASTER && message.Flag) { if (message.Priority > priority) { this.status = BackupStatus.SLAVER; } else if (message.Priority == priority && this.local_ip.CompareTo(ip) < 0) { this.status = BackupStatus.SLAVER; } } }
public async Task ReceiveTwoKeepAlives() { var message = new KeepAliveMessage(); var buffer = message.Encode(); var handle = new AutoResetEvent(false); await NetworkIO.SendAsync(Outgoing, buffer, 0, buffer.Length, null, null, null); var sendTask = NetworkIO.SendAsync(Outgoing, buffer, 0, buffer.Length, null, null, null); var task = PeerIO.ReceiveMessageAsync(Incoming, PlainTextEncryption.Instance, null, null, null); Assert.IsTrue(task.Wait(TimeSpan.FromSeconds(2)), "#Should receive first message"); task = PeerIO.ReceiveMessageAsync(Incoming, PlainTextEncryption.Instance, null, null, null); Assert.IsTrue(task.Wait(TimeSpan.FromSeconds(2)), "#Should receive second message"); await sendTask; }
private void InitializeAnnouncingAliveThread() { announceAliveThread = new Thread(() => { lock (announceAliveLock) { announcingAllowed = true; } Log.Info("Created AnnounceIsAlive thread"); var timeStamp = (DateTime.UtcNow - new DateTime(1970, 1, 1)).Milliseconds; try { while (announcingAllowed) { KeepAliveMessage message = new KeepAliveMessage() { AccessCode = accessCode, OptionalUrl = "", TeamId = teamName, TimeStamp = timeStamp }; Publish(teamName, RoutingKeyNames.Announce, serializer.Serialize(message)); Thread.Sleep(1000); } Log.Info("Terminating AnnounceIsAlive thread"); } catch (Exception e) { Log.Info(e.Message); } }); announceAliveThread.Start(); }
public static void SendKAM(IPEndPoint ipEndPoint, Socket socketData, Socket socketVideo) { // Création des messages KeepAlive en JSON KeepAliveMessage kamDataJson = new KeepAliveMessage() { op = "start", type = "live.data.unicast", key = "some_GUID" }; KeepAliveMessage kamVideoJson = new KeepAliveMessage() { op = "start", type = "live.video.unicast", key = "some_Other_GUID" }; // Conversion des messages KeepAlive du JSON au string n string kamDataString = JsonUtility.ToJson(kamDataJson); string kamVideoString = JsonUtility.ToJson(kamVideoJson); Console.WriteLine(kamDataString); // Conversion des messages KeepAlive du string au bytes byte[] kaDataBytes = Encoding.ASCII.GetBytes(kamDataString); byte[] kaDataVideo = Encoding.ASCII.GetBytes(kamVideoString); // Envoi des KeepAlive message socketData.SendTo(kaDataBytes, ipEndPoint); socketVideo.SendTo(kaDataVideo, ipEndPoint); }
public void ReceiveTwoKeepAlives() { var message = new KeepAliveMessage(); var buffer = message.Encode(); var handle = new AutoResetEvent(false); NetworkIO.EnqueueSend(Outgoing, buffer, 0, buffer.Length, null, null, null, delegate { }, null); NetworkIO.EnqueueSend(Outgoing, buffer, 0, buffer.Length, null, null, null, delegate { }, null); AsyncMessageReceivedCallback callback = (s, m, state) => { if (s && m is KeepAliveMessage) { handle.Set(); } }; PeerIO.EnqueueReceiveMessage(Incoming, new PlainTextEncryption(), null, null, null, callback, null); Assert.IsTrue(handle.WaitOne(TimeSpan.FromSeconds(2)), "#Should receive first message"); PeerIO.EnqueueReceiveMessage(Incoming, new PlainTextEncryption(), null, null, null, callback, null); Assert.IsTrue(handle.WaitOne(TimeSpan.FromSeconds(2)), "#Should receive second message"); }
void OnKeepAliveMessage(KeepAliveMessage message) { var user = new UserInfo() { ID = message.Sender.ClientID, PresenceEndPoint = message.Sender.Address }; bool existingUser; lock (aliveUsers) existingUser = aliveUsers.ContainsKey(user); if (existingUser) { HeIsAlive(user); } else { UserDiscovered(this, new KeepAliveEventArgs() { User = new SquiggleEndPoint(user.ID, user.PresenceEndPoint) }); } }
private void KeepAliveMessageReceived(KeepAliveMessage message) { this.m_keepAliveTime = DateTime.UtcNow; this.SendMessage(new KeepAliveServerMessage()); }
public override PiranhaMessage CreateMessageByType(int type) { PiranhaMessage message = null; if (type < 20000) { switch (type) { case ClientCryptoErrorMessage.MESSAGE_TYPE: { message = new ClientCryptoErrorMessage(); break; } case ClientHelloMessage.MESSAGE_TYPE: { message = new ClientHelloMessage(); break; } case LoginMessage.MESSAGE_TYPE: { message = new LoginMessage(); break; } case KeepAliveMessage.MESSAGE_TYPE: { message = new KeepAliveMessage(); break; } case SetDeviceTokenMessage.MESSAGE_TYPE: { message = new SetDeviceTokenMessage(); break; } case ResetAccountMessage.MESSAGE_TYPE: { message = new ResetAccountMessage(); break; } case ReportUserMessage.MESSAGE_TYPE: { message = new ReportUserMessage(); break; } case AccountSwitchedMessage.MESSAGE_TYPE: { message = new AccountSwitchedMessage(); break; } case UnlockAccountMessage.MESSAGE_TYPE: { message = new UnlockAccountMessage(); break; } case AppleBillingRequestMessage.MESSAGE_TYPE: { message = new AppleBillingRequestMessage(); break; } case ChangeAvatarNameMessage.MESSAGE_TYPE: { message = new ChangeAvatarNameMessage(); break; } case AcceptFriendMessage.MESSAGE_TYPE: { message = new AcceptFriendMessage(); break; } case AddFriendMessage.MESSAGE_TYPE: { message = new AddFriendMessage(); break; } case AskForFriendListMessage.MESSAGE_TYPE: { message = new AskForFriendListMessage(); break; } case RemoveFriendMessage.MESSAGE_TYPE: { message = new RemoveFriendMessage(); break; } case StartFriendLiveSpectateMessage.MESSAGE_TYPE: { message = new StartFriendLiveSpectateMessage(); break; } case InboxOpenedMessage.MESSAGE_TYPE: { message = new InboxOpenedMessage(); break; } case GoHomeMessage.MESSAGE_TYPE: { message = new GoHomeMessage(); break; } case EndClientTurnMessage.MESSAGE_TYPE: { message = new EndClientTurnMessage(); break; } case CancelMatchmakingMessage.MESSAGE_TYPE: { message = new CancelMatchmakingMessage(); break; } case AttackHomeMessage.MESSAGE_TYPE: { message = new AttackHomeMessage(); break; } case StartFriendlyChallengeSpectateMessage.MESSAGE_TYPE: { message = new StartFriendlyChallengeSpectateMessage(); break; } case ScoutFriendlyBattleMessage.MESSAGE_TYPE: { message = new ScoutFriendlyBattleMessage(); break; } case VisitHomeMessage.MESSAGE_TYPE: { message = new VisitHomeMessage(); break; } case HomeBattleReplayMessage.MESSAGE_TYPE: { message = new HomeBattleReplayMessage(); break; } case AttackMatchedHomeMessage.MESSAGE_TYPE: { message = new AttackMatchedHomeMessage(); break; } case AcceptFriendlyBattleMessage.MESSAGE_TYPE: { message = new AcceptFriendlyBattleMessage(); break; } case CancelChallengeMessage.MESSAGE_TYPE: { message = new CancelChallengeMessage(); break; } case AttackNpcMessage.MESSAGE_TYPE: { message = new AttackNpcMessage(); break; } case DuelNpcMessage.MESSAGE_TYPE: { message = new DuelNpcMessage(); break; } case BindGoogleServiceAccountMessage.MESSAGE_TYPE: { message = new BindGoogleServiceAccountMessage(); break; } case BindFacebookAccountMessage.MESSAGE_TYPE: { message = new BindFacebookAccountMessage(); break; } case CreateAllianceMessage.MESSAGE_TYPE: { message = new CreateAllianceMessage(); break; } case AskForAllianceDataMessage.MESSAGE_TYPE: { message = new AskForAllianceDataMessage(); break; } case AskForJoinableAlliancesListMessage.MESSAGE_TYPE: { message = new AskForJoinableAlliancesListMessage(); break; } case JoinAllianceMessage.MESSAGE_TYPE: { message = new JoinAllianceMessage(); break; } case ChangeAllianceMemberRoleMessage.MESSAGE_TYPE: { message = new ChangeAllianceMemberRoleMessage(); break; } case LeaveAllianceMessage.MESSAGE_TYPE: { message = new LeaveAllianceMessage(); break; } case DonateAllianceUnitMessage.MESSAGE_TYPE: { message = new DonateAllianceUnitMessage(); break; } case ChatToAllianceStreamMessage.MESSAGE_TYPE: { message = new ChatToAllianceStreamMessage(); break; } case ChangeAllianceSettingsMessage.MESSAGE_TYPE: { message = new ChangeAllianceSettingsMessage(); break; } case RequestJoinAllianceMessage.MESSAGE_TYPE: { message = new RequestJoinAllianceMessage(); break; } case RespondToAllianceJoinRequestMessage.MESSAGE_TYPE: { message = new RespondToAllianceJoinRequestMessage(); break; } case SendAllianceInvitationMessage.MESSAGE_TYPE: { message = new SendAllianceInvitationMessage(); break; } case JoinAllianceUsingInvitationMessage.MESSAGE_TYPE: { message = new JoinAllianceUsingInvitationMessage(); break; } case SearchAlliancesMessage.MESSAGE_TYPE: { message = new SearchAlliancesMessage(); break; } case AskForAvatarProfileMessage.MESSAGE_TYPE: { message = new AskForAvatarProfileMessage(); break; } case AskForAllianceBookmarksFullDataMessage.MESSAGE_TYPE: { message = new AskForAllianceBookmarksFullDataMessage(); break; } case AddAllianceBookmarkMessage.MESSAGE_TYPE: { message = new AddAllianceBookmarkMessage(); break; } case RemoveAllianceBookmarkMessage.MESSAGE_TYPE: { message = new RemoveAllianceBookmarkMessage(); break; } case AskForAllianceRankingListMessage.MESSAGE_TYPE: { message = new AskForAllianceRankingListMessage(); break; } case AskForAvatarRankingListMessage.MESSAGE_TYPE: { message = new AskForAvatarRankingListMessage(); break; } case AskForAvatarLocalRankingListMessage.MESSAGE_TYPE: { message = new AskForAvatarLocalRankingListMessage(); break; } case AskForAvatarLastSeasonRankingListMessage.MESSAGE_TYPE: { message = new AskForAvatarLastSeasonRankingListMessage(); break; } case AskForAvatarDuelLastSeasonRankingListMessage.MESSAGE_TYPE: { message = new AskForAvatarDuelLastSeasonRankingListMessage(); break; } case RemoveAvatarStreamEntryMessage.MESSAGE_TYPE: { message = new RemoveAvatarStreamEntryMessage(); break; } case AskForLeagueMemberListMessage.MESSAGE_TYPE: { message = new AskForLeagueMemberListMessage(); break; } case BattleEndClientTurnMessage.MESSAGE_TYPE: { message = new BattleEndClientTurnMessage(); break; } case AvatarNameCheckRequestMessage.MESSAGE_TYPE: { message = new AvatarNameCheckRequestMessage(); break; } case SendGlobalChatLineMessage.MESSAGE_TYPE: { message = new SendGlobalChatLineMessage(); break; } case Village2AttackStartSpectateMessage.MESSAGE_TYPE: { message = new Village2AttackStartSpectateMessage(); break; } } } else { switch (type) { case SetEncryptionMessage.MESSAGE_TYPE: { message = new ExtendedSetEncryptionMessage(); break; } case ServerHelloMessage.MESSAGE_TYPE: { message = new ServerHelloMessage(); break; } case LoginFailedMessage.MESSAGE_TYPE: { message = new LoginFailedMessage(); break; } case LoginOkMessage.MESSAGE_TYPE: { message = new LoginOkMessage(); break; } case FriendListMessage.MESSAGE_TYPE: { message = new FriendListMessage(); break; } case FriendListUpdateMessage.MESSAGE_TYPE: { message = new FriendListUpdateMessage(); break; } case KeepAliveServerMessage.MESSAGE_TYPE: { message = new KeepAliveServerMessage(); break; } case AddFriendErrorMessage.MESSAGE_TYPE: { message = new AddFriendErrorMessage(); break; } case ReportUserStatusMessage.MESSAGE_TYPE: { message = new ReportUserStatusMessage(); break; } case UnlockAccountOkMessage.MESSAGE_TYPE: { message = new UnlockAccountOkMessage(); break; } case UnlockAccountFailedMessage.MESSAGE_TYPE: { message = new UnlockAccountFailedMessage(); break; } case AppleBillingProcessedByServerMessage.MESSAGE_TYPE: { message = new AppleBillingProcessedByServerMessage(); break; } case ShutdownStartedMessage.MESSAGE_TYPE: { message = new ShutdownStartedMessage(); break; } case PersonalBreakStartedMessage.MESSAGE_TYPE: { message = new PersonalBreakStartedMessage(); break; } case FacebookAccountBoundMessage.MESSAGE_TYPE: { message = new FacebookAccountBoundMessage(); break; } case AvatarNameChangeFailedMessage.MESSAGE_TYPE: { message = new AvatarNameChangeFailedMessage(); break; } case AvatarOnlineStatusUpdated.MESSAGE_TYPE: { message = new AvatarOnlineStatusUpdated(); break; } case AvatarOnlineStatusListMessage.MESSAGE_TYPE: { message = new AvatarOnlineStatusListMessage(); break; } case AllianceOnlineStatusUpdatedMessage.MESSAGE_TYPE: { message = new AllianceOnlineStatusUpdatedMessage(); break; } case GoogleServiceAccountBoundMessage.MESSAGE_TYPE: { message = new GoogleServiceAccountBoundMessage(); break; } case GoogleServiceAccountAlreadyBoundMessage.MESSAGE_TYPE: { message = new GoogleServiceAccountAlreadyBoundMessage(); break; } case AvatarNameCheckResponseMessage.MESSAGE_TYPE: { message = new AvatarNameCheckResponseMessage(); break; } case AcceptFriendErrorMessage.MESSAGE_TYPE: { message = new AcceptFriendErrorMessage(); break; } case OwnHomeDataMessage.MESSAGE_TYPE: { message = new OwnHomeDataMessage(); break; } case AttackHomeFailedMessage.MESSAGE_TYPE: { message = new AttackHomeFailedMessage(); break; } case OutOfSyncMessage.MESSAGE_TYPE: { message = new OutOfSyncMessage(); break; } case EnemyHomeDataMessage.MESSAGE_TYPE: { message = new EnemyHomeDataMessage(); break; } case AvailableServerCommandMessage.MESSAGE_TYPE: { message = new AvailableServerCommandMessage(); break; } case WaitingToGoHomeMessage.MESSAGE_TYPE: { message = new WaitingToGoHomeMessage(); break; } case VisitedHomeDataMessage.MESSAGE_TYPE: { message = new VisitedHomeDataMessage(); break; } case HomeBattleReplayDataMessage.MESSAGE_TYPE: { message = new HomeBattleReplayDataMessage(); break; } case ServerErrorMessage.MESSAGE_TYPE: { message = new ServerErrorMessage(); break; } case HomeBattleReplayFailedMessage.MESSAGE_TYPE: { message = new HomeBattleReplayFailedMessage(); break; } case LiveReplayHeaderMessage.MESSAGE_TYPE: { message = new LiveReplayHeaderMessage(); break; } case LiveReplayDataMessage.MESSAGE_TYPE: { message = new LiveReplayDataMessage(); break; } case ChallengeFailedMessage.MESSAGE_TYPE: { message = new ChallengeFailedMessage(); break; } case VisitFailedMessage.MESSAGE_TYPE: { message = new VisitFailedMessage(); break; } case AttackSpectatorCountMessage.MESSAGE_TYPE: { message = new AttackSpectatorCountMessage(); break; } case LiveReplayEndMessage.MESSAGE_TYPE: { message = new LiveReplayEndMessage(); break; } case LiveReplayFailedMessage.MESSAGE_TYPE: { message = new LiveReplayFailedMessage(); break; } case NpcDataMessage.MESSAGE_TYPE: { message = new NpcDataMessage(); break; } case AllianceDataMessage.MESSAGE_TYPE: { message = new AllianceDataMessage(); break; } case AllianceJoinFailedMessage.MESSAGE_TYPE: { message = new AllianceJoinFailedMessage(); break; } case JoinableAllianceListMessage.MESSAGE_TYPE: { message = new JoinableAllianceListMessage(); break; } case AllianceListMessage.MESSAGE_TYPE: { message = new AllianceListMessage(); break; } case AllianceStreamMessage.MESSAGE_TYPE: { message = new AllianceStreamMessage(); break; } case AllianceStreamEntryMessage.MESSAGE_TYPE: { message = new AllianceStreamEntryMessage(); break; } case AllianceStreamEntryRemovedMessage.MESSAGE_TYPE: { message = new AllianceStreamEntryRemovedMessage(); break; } case AllianceJoinRequestOkMessage.MESSAGE_TYPE: { message = new AllianceJoinRequestOkMessage(); break; } case AllianceJoinRequestFailedMessage.MESSAGE_TYPE: { message = new AllianceJoinRequestFailedMessage(); break; } case AllianceInvitationSendFailedMessage.MESSAGE_TYPE: { message = new AllianceInvitationSendFailedMessage(); break; } case AllianceInvitationSentOkMessage.MESSAGE_TYPE: { message = new AllianceInvitationSentOkMessage(); break; } case AllianceFullEntryUpdateMessage.MESSAGE_TYPE: { message = new AllianceFullEntryUpdateMessage(); break; } case AllianceWarSearchDataMessage.MESSAGE_TYPE: { message = new AllianceWarSearchDataMessage(); break; } case AllianceWarDataMessage.MESSAGE_TYPE: { message = new AllianceWarDataMessage(); break; } case AllianceCreateFailedMessage.MESSAGE_TYPE: { message = new AllianceCreateFailedMessage(); break; } case AvatarProfileMessage.MESSAGE_TYPE: { message = new AvatarProfileMessage(); break; } case AllianceWarFullEntryMessage.MESSAGE_TYPE: { message = new AllianceWarFullEntryMessage(); break; } case AllianceWarDataFailedMessage.MESSAGE_TYPE: { message = new AllianceWarDataFailedMessage(); break; } case AllianceWarHistoryMessage.MESSAGE_TYPE: { message = new AllianceWarHistoryMessage(); break; } case AvatarProfileFailedMessage.MESSAGE_TYPE: { message = new AvatarProfileFailedMessage(); break; } case BookmarksListMessage.MESSAGE_TYPE: { message = new BookmarksListMessage(); break; } case AllianceBookmarksFullDataMessage.MESSAGE_TYPE: { message = new AllianceBookmarksFullDataMessage(); break; } case Village2AttackEntryListMessage.MESSAGE_TYPE: { message = new Village2AttackEntryListMessage(); break; } case Village2AttackEntryUpdateMessage.MESSAGE_TYPE: { message = new Village2AttackEntryUpdateMessage(); break; } case Village2AttackEntryAddedMessage.MESSAGE_TYPE: { message = new Village2AttackEntryAddedMessage(); break; } case Village2AttackEntryRemovedMessage.MESSAGE_TYPE: { message = new Village2AttackEntryRemovedMessage(); break; } case AllianceRankingListMessage.MESSAGE_TYPE: { message = new AllianceRankingListMessage(); break; } case AllianceLocalRankingListMessage.MESSAGE_TYPE: { message = new AllianceLocalRankingListMessage(); break; } case AvatarRankingListMessage.MESSAGE_TYPE: { message = new AvatarRankingListMessage(); break; } case AvatarLocalRankingListMessage.MESSAGE_TYPE: { message = new AvatarLocalRankingListMessage(); break; } case AvatarLastSeasonRankingListMessage.MESSAGE_TYPE: { message = new AvatarLastSeasonRankingListMessage(); break; } case AvatarDuelLocalRankingListMessage.MESSAGE_TYPE: { message = new AvatarDuelLocalRankingListMessage(); break; } case AvatarDuelLastSeasonRankingListMessage.MESSAGE_TYPE: { message = new AvatarDuelLastSeasonRankingListMessage(); break; } case AvatarDuelRankingListMessage.MESSAGE_TYPE: { message = new AvatarDuelRankingListMessage(); break; } case AvatarStreamMessage.MESSAGE_TYPE: { message = new AvatarStreamMessage(); break; } case AvatarStreamEntryMessage.MESSAGE_TYPE: { message = new AvatarStreamEntryMessage(); break; } case AvatarStreamEntryRemovedMessage.MESSAGE_TYPE: { message = new AvatarStreamEntryRemovedMessage(); break; } case LeagueMemberListMessage.MESSAGE_TYPE: { message = new LeagueMemberListMessage(); break; } case GlobalChatLineMessage.MESSAGE_TYPE: { message = new GlobalChatLineMessage(); break; } case AllianceWarEventMessage.MESSAGE_TYPE: { message = new AllianceWarEventMessage(); break; } case FriendlyScoutHomeDataMessage.MESSAGE_TYPE: { message = new FriendlyScoutHomeDataMessage(); break; } case Village2AttackAvatarDataMessage.MESSAGE_TYPE: { message = new Village2AttackAvatarDataMessage(); break; } case AttackEventMessage.MESSAGE_TYPE: { message = new AttackEventMessage(); break; } case TitanDisconnectedMessage.MESSAGE_TYPE: { message = new DisconnectedMessage(); break; } case CryptoErrorMessage.MESSAGE_TYPE: { message = new CryptoErrorMessage(); break; } } } return(message); }
protected virtual void HandleKeepAliveMessage(PeerId id, KeepAliveMessage message) { id.LastMessageReceived.Restart(); }
public KeepAliveOkMessage(Device client, KeepAliveMessage cka) : base(client) { this.Identifier = 20108; }
public KeepAliveOkMessage(PacketProcessing.Client client, KeepAliveMessage cka) : base(client) { SetMessageType(20108); }
protected virtual void HandleKeepAliveMessage(PeerId id, KeepAliveMessage message) { id.LastMessageReceived = DateTime.Now; }
protected virtual void HandleKeepAliveMessage(PeerId id, KeepAliveMessage message) { id.LastMessageReceived = DateTime.Now; }
void peer_KeepAliveMessageReceived(object sender, KeepAliveMessage e) { ShowMessage("{0}:Received {1}", sender, e); }
/// <summary> /// Creates a message by type. /// </summary> public override PiranhaMessage CreateMessageByType(int type) { PiranhaMessage message = null; if (type < 20000) { switch (type) { case 10100: { message = new ClientHelloMessage(); break; } case 10101: { message = new LoginMessage(); break; } case 10108: { message = new KeepAliveMessage(); break; } case 10113: { message = new SetDeviceTokenMessage(); break; } case 10116: { message = new ResetAccountMessage(); break; } case 10117: { message = new ReportUserMessage(); break; } case 10118: { message = new AccountSwitchedMessage(); break; } case 10150: { message = new AppleBillingRequestMessage(); break; } case 10212: { message = new ChangeAvatarNameMessage(); break; } case 14101: { message = new GoHomeMessage(); break; } case 14102: { message = new EndClientTurnMessage(); break; } case 14134: { message = new AttackNpcMessage(); break; } case 14262: { message = new BindGoogleServiceAccountMessage(); break; } case 14325: { message = new AskForAvatarProfileMessage(); break; } case 14715: { message = new SendGlobalChatLineMessage(); break; } } } else { switch (type) { case 20000: { message = new ExtendedSetEncryptionMessage(); break; } case 20100: { message = new ServerHelloMessage(); break; } case 20103: { message = new LoginFailedMessage(); break; } case 20104: { message = new LoginOkMessage(); break; } case 20108: { message = new KeepAliveServerMessage(); break; } case 20117: { message = new ReportUserStatusMessage(); break; } case 20151: { message = new AppleBillingProcessedByServerMessage(); break; } case 20161: { message = new ShutdownStartedMessage(); break; } case 20171: { message = new PersonalBreakStartedMessage(); break; } case 20261: { message = new GoogleServiceAccountBoundMessage(); break; } case 20262: { message = new GoogleServiceAccountAlreadyBoundMessage(); break; } case 24101: { message = new OwnHomeDataMessage(); break; } case 24104: { message = new OutOfSyncMessage(); break; } case 24111: { message = new AvailableServerCommand(); break; } case 24112: { message = new WaitingToGoHomeMessage(); break; } case 24115: { message = new ServerErrorMessage(); break; } case 24133: { message = new NpcDataMessage(); break; } case 24334: { message = new AvatarProfileMessage(); break; } case 24411: { message = new AvatarStreamMessage(); break; } case 24715: { message = new GlobalChatLineMessage(); break; } } } return(message); }
public void HandleKeepAliveMessage(KeepAliveMessage keepAliveMessage) { throw new NotImplementedException(); }
public void HandleKeepAliveMessage(KeepAliveMessage keepAliveMessage) { }