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; } } }
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; } } }