Exemplo n.º 1
0
 public void Broadcast(Peer[] peers, BroadcastType broadcastType, Dictionary<byte, object> parameter)
 {
     EventData eventData = new EventData((byte)broadcastType, parameter);
     foreach (Peer peer in peers)
     {
         peer.SendEvent(eventData);
     }
 }
Exemplo n.º 2
0
 internal void SendEvent(EventData eventData)
 {
     try
     {
         byte[] data = Encoding.Default.GetBytes(JsonConvert.SerializeObject(new CommunicationParameter((byte)ParamaterType.EventData, eventData), new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto })+ "XXXXXXXX");
         tcpClient.GetStream().Write(data, 0, data.Length);
     }
     catch (Exception ex)
     {
         server.logger.Error(guid.ToString() + " : " + ex.Message);
         server.logger.Error(guid.ToString() + " : " + ex.StackTrace);
     }
 }