void benchmarkServer_OnServerNotify(NetworkServerClientWorker worker, NetworkServerClientWorker.NetworkClientNotification data) { switch (data.EventType) { case NetworkClientBase.ClientEventTypeEnum.None: break; case NetworkClientBase.ClientEventTypeEnum.Connected: break; case NetworkClientBase.ClientEventTypeEnum.Accepted: bm_server_Accepted++; break; case NetworkClientBase.ClientEventTypeEnum.RawDataRecieved: bm_server_RawDataRecieved++; break; case NetworkClientBase.ClientEventTypeEnum.MessageRecieved: ((NetworkServerClientAccepter)worker).DataToSend = (byte[])data.EventData; bm_server_MessagesRecieved++; break; case NetworkClientBase.ClientEventTypeEnum.MessageSent: bm_server_MessagesSent++; break; case NetworkClientBase.ClientEventTypeEnum.RemoteSideDisconnected: bm_server_RemoteDisconnections++; break; case NetworkClientBase.ClientEventTypeEnum.Disconnected: bm_server_Disconnections++; break; case NetworkClientBase.ClientEventTypeEnum.Error: bm_server_Errors++; break; } }
void chatServer_OnServerNotify(NetworkServerClientWorker worker, NetworkServerClientWorker.NetworkClientNotification data) { switch (((NetworkServerClientWorker.NetworkClientNotification)data).EventType) { case NetworkClientBase.ClientEventTypeEnum.Accepted: lblConnectedClientsData.BeginInvoke(new dlgUpdater(updateConnectedClientsAmount)); break; case NetworkClientBase.ClientEventTypeEnum.Disconnected: lblConnectedClientsData.BeginInvoke(new dlgUpdater(updateConnectedClientsAmount)); break; case NetworkClientBase.ClientEventTypeEnum.MessageRecieved: foreach (NetworkServerClientAccepter accepter in chatServer.Accepters) accepter.DataToSend = (byte[]) ((NetworkServerClientWorker.NetworkClientNotification)data).EventData; // This would get a specific worker by key and will send Hello through it. // chatServer.GetAccepter(worker.Key).DataToSend = // System.Text.Encoding.Unicode.GetBytes("Hello"); break; } }