Пример #1
0
 internal void OnMessageReceived(Client client, byte[] message, MessageKind messageKind)
 {
     if (messageKind == MessageKind.Message)
     {
         MessageReceived(this, ServerReceivedEventArgs.NewEvent(client, message, messageKind));
     }
     else if (messageKind == MessageKind.ListClientId)
     {
         client.Send(clients.Keys.ToArrayOfByte(), MessageKind.ListClientId);
     }
 }
Пример #2
0
 private void server_OnMessageReceived(Server sender, ServerReceivedEventArgs eventArgs)
 {
     if (eventArgs.Message != null)
     {
         var text = Encoding.UTF8.GetString(eventArgs.Message);
         text = string.Format("From Client Id {0}: {1}", eventArgs.Client.Id, text);
         HandleNewMsg(Environment.NewLine + text);
         if (eventArgs.MessageKind == MessageKind.Message)
         {
             server.SendAll(text);
         }
     }
 }