When I receive a packet I do something like this:
But would it take more resources or it wouldn't matter, if so is there other ways that's better?
Code:
public static void NewPacket(SocketClient Client, byte[] Packet)
{
if (Kernel.SafePacket(Client, Packet))
{
//Handle
}
}
Code:
public static bool SafePacket(SocketClient Client, byte[] Packet)
{
if (Client == null || Packet == null)
return false;
return (Packet.Length > 0 && Packet.Length <= MaxPacketSize);
}