2
I have an online game server and have 600 online users, but the cpu is a little high (using 10~20% of 26GHz) and the profiler says that this line is using a lot of resources
Socket.BeginSend(packet, 0, packet.Length, 0, OnSendCompleted, null);
Code of the callback:
private void OnSendCompleted(IAsyncResult async)
{
try
{
if (Socket != null && Socket.Connected && _connected)
Socket.EndSend(async);
else
Disconnect();
}
catch (Exception exception)
{
HandleDisconnect(exception);
}
}