Пример #1
0
        internal void HandleMessage(byte[] message, IPAddress endpoint)
        {
            SocketMessage msg    = Serializer.Deserialize <SocketMessage>(message);
            IPEndPoint    ipPort = new IPEndPoint(endpoint, msg.CallbackPort);

            if (Emitters.ContainsKey(msg.Event))
            {
                lock (_lockEmitter)
                {
                    CurrentEmitter = Emitters[msg.Event];
                    CurrentEmitter.Invoke(msg, ipPort);
                    CurrentEmitter = null;
                }
            }
        }
Пример #2
0
        internal void HandleMessage(string message, IPAddress endpoint)
        {
            var           bytes  = System.Text.Encoding.UTF8.GetBytes(message);
            SocketMessage msg    = Serializer.Deserialize <SocketMessage>(bytes);
            IPEndPoint    ipPort = new IPEndPoint(endpoint, msg.CallbackPort);

            if (Emitters.ContainsKey(msg.Event))
            {
                lock (_lockEmitter)
                {
                    CurrentEmitter = Emitters[msg.Event];
                    CurrentEmitter.Invoke(msg, ipPort);
                    CurrentEmitter = null;
                }
            }
        }