完善ProcessAccept

This commit is contained in:
sin365 2024-01-22 13:04:27 +08:00
parent 4211f40b6c
commit 4330dd92a5
2 changed files with 54 additions and 45 deletions

View File

@ -321,6 +321,9 @@ namespace HaoYueNet.ServerNetwork
try
{
Interlocked.Increment(ref m_clientCount);
//确保监听结束时,有连接才抛给数据接收
if (e.AcceptSocket.RemoteEndPoint != null)
{
// Get the socket for the accepted client connection and put it into the
//ReadEventArg object user token
SocketAsyncEventArgs readEventArgs = m_Receivepool.Pop();
@ -347,6 +350,7 @@ namespace HaoYueNet.ServerNetwork
ProcessReceive(readEventArgs);
}
}
}
catch (Exception me)
{
//RuncomLib.Log.LogUtils.Info(me.Message + "\r\n" + me.StackTrace);

View File

@ -321,6 +321,10 @@ namespace HaoYueNet.ServerNetwork
try
{
Interlocked.Increment(ref m_clientCount);
//确保监听结束时,有连接才抛给数据接收
if (e.AcceptSocket.RemoteEndPoint != null)
{
// Get the socket for the accepted client connection and put it into the
//ReadEventArg object user token
SocketAsyncEventArgs readEventArgs = m_Receivepool.Pop();
@ -347,6 +351,7 @@ namespace HaoYueNet.ServerNetwork
ProcessReceive(readEventArgs);
}
}
}
catch (Exception me)
{
//RuncomLib.Log.LogUtils.Info(me.Message + "\r\n" + me.StackTrace);