Exemplo n.º 1
0
        private void OnReceived(object sender, ReceiveEventArgs e)
        {
            lock (m_MessageLocker)
            {
                ServerLogMessage message = new ServerLogMessage();

                int    id           = BitConverter.ToInt32(e.bytes, 0);
                byte[] contentBytes = new byte[0];
                if (e.bytes.Length > sizeof(int))
                {
                    contentBytes = new byte[e.bytes.Length - sizeof(int)];
                    Array.Copy(e.bytes, sizeof(int), contentBytes, 0, contentBytes.Length);
                }
                message.ID      = id;
                message.Client  = e.client;
                message.Message = contentBytes;

                m_ReceivedMessages.Add(message);
            }
        }