Socket.Beginsend Using a lot cpu

Asked

Viewed 31 times

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);
        }
    }

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.