An AsyncCallback
after Socket.BeginReceive
is not called while the server is being initialized during startup.
mSocket.BeginReceive(mBuffer, 0, mBuffer.Length, SocketFlags.None, new AsyncCallback(onReceive), mSocket);
private void onReceive(IAsyncResult result)
{
if (mSocket == null) return;
Monitor.Enter(mLockObj);
mSocket.EndReceive(result);
//...
Do I need to create some timeout logic or is there an exception case I can catch and handle?