private void DoNetCycle()
{
// Receive a packet
IPEndPoint sender = new IPEndPoint(IPAddress.Any, Port);
byte[] rawPacket;
try
{
rawPacket = UdpClient.Receive(ref sender);
}
catch (SocketException)
{
// Maybe we just killed the client?
return;
}
// Get the associated client (or create a new fake one)
SOEClient client = ConnectionManager.GetClientFromHost(sender);
if (client == null)
{
// Make a fake client for new connections
client = new SOEClient(ConnectionManager, sender);
}
// Do we wanna handle this, or give it to our workers?
if (WANT_PACKET_THREADING)
{
// Put it in the queue for our workers..
IncomingPackets.Enqueue(new SOEPendingPacket(client, rawPacket));
}
else
{
// Handle the packet
Protocol.HandlePacket(client, rawPacket);
}
}