예제 #1
0
        private void Client_MessageReceived(object sender, ClientReceiveEventArgs e)
        {
            string message = BytesToString(e.Data);

            if (string.IsNullOrEmpty(message))
            {
                // TODO(jweyrich): Handle invalid message.
                return;
            }

            string[] lines = message.Split('\n');
            foreach (string line in lines)
            {
                if (!string.IsNullOrEmpty(line))
                {
                    HandleMessage(line);
                }
            }
        }
예제 #2
0
 protected virtual void OnMessageReceived(ClientReceiveEventArgs e)
 {
     logger.Debug("RECEIVED: {0}", Encoding.ASCII.GetString(e.Data, 0, e.Data.Length));
     InvokeDelegate(MessageReceived, e);
 }