/// <summary> /// Forwards raw packets straight to the associated client. /// </summary> /// <param name="buffer"></param> private void ForwardToClient(byte[] buffer) { GatewayClient client = null; try { uint session = BitConverter.ToUInt32(buffer, 2); if (GatewayPool.Instance.lookup.TryGetValue(session, out client)) { client.Send(buffer); } else { Console.WriteLine("Unable to find client"); } } catch (ObjectDisposedException) { if (client != null) { client.world = null; client.Close(); } } catch (Exception) { if (client != null) { client.world = null; client.Close(); } } }