void OnPacketReceived(object sender, PacketReceivedEventArgs e) { SetTimeout(); if (e.Packet.Length != 0) { if (clientAuthenticated) { MethodCall mc = (MethodCall)DeserializeObject(e.Packet); mc.CallOn(hostObject); } else { if (ArrayEquals(e.Packet, password)) { clientAuthenticated = true; } else { Kill(); throw new InvalidOperationException("Worker process authentication failed."); } } } }