0

当套接字为空时,它落后于所有连接的人,我想知道这可能是什么原因,受影响的代码如下。

public void SendData(byte[] Data)
    {
        try
        {
            if (Stopped)
            {
                return;
            }

            if (mSocket != null)
            {
                Output.WriteLine("[SND][" + mId + "]: " + Constants.DefaultEncoding.GetString(Data),
                    OutputLevel.DebugInformation);
                mSocket.BeginSend(Data, 0, Data.Length, SocketFlags.None, new AsyncCallback(OnDataSent), null);
            }
            else
            {
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    Stop(MySqlClient);
                }
            }
        }
        catch (Exception e)
        {
           //SOCKETISNULL
        }
    }
4

0 回答 0