B
Bob
Can someone tell my why when I call Socket.BeginReceive() the callback is
called on the same thread? I thought that BeginReceive was ALWAYS an async
method. Below is the call stack. You can see its calling my callback
"Connection()" from the same thread.
My problem is that I call Accept() then BeginReceive(). If its processed on
the same thread then other connections will not be accepted. I could pass
it to another thread myself but shouldn't BeginReceive work this way?
MyApp.exe!MyApp.MStore.Connection(System.IAsyncResult iar =
{System.Net.Sockets.OverlappedAsyncResult}) Line 416 + 0x32 bytes C#
System.dll!System.Net.LazyAsyncResult.Complete(System.IntPtr userToken) +
0x7f bytes
System.dll!System.Net.ContextAwareResult.CaptureOrComplete(ref
System.Threading.ExecutionContext cachedContext, bool returnContext) + 0x12b
bytes
System.dll!System.Net.ContextAwareResult.FinishPostingAsyncOp(ref
System.Net.CallbackClosure closure = null) + 0x69 bytes
System.dll!System.Net.Sockets.Socket.BeginReceive(byte[] buffer, int offset,
int size, System.Net.Sockets.SocketFlags socketFlags, out
System.Net.Sockets.SocketError errorCode, System.AsyncCallback callback,
object state) + 0x14d bytes
System.dll!System.Net.Sockets.Socket.BeginReceive(byte[] buffer, int offset,
int size, System.Net.Sockets.SocketFlags socketFlags, System.AsyncCallback
callback, object state) + 0x23 bytes
MyApp.exe!MyApp.MStore.WorkerThread() Line 625 + 0x38 bytes C#
called on the same thread? I thought that BeginReceive was ALWAYS an async
method. Below is the call stack. You can see its calling my callback
"Connection()" from the same thread.
My problem is that I call Accept() then BeginReceive(). If its processed on
the same thread then other connections will not be accepted. I could pass
it to another thread myself but shouldn't BeginReceive work this way?
MyApp.exe!MyApp.MStore.Connection(System.IAsyncResult iar =
{System.Net.Sockets.OverlappedAsyncResult}) Line 416 + 0x32 bytes C#
System.dll!System.Net.LazyAsyncResult.Complete(System.IntPtr userToken) +
0x7f bytes
System.dll!System.Net.ContextAwareResult.CaptureOrComplete(ref
System.Threading.ExecutionContext cachedContext, bool returnContext) + 0x12b
bytes
System.dll!System.Net.ContextAwareResult.FinishPostingAsyncOp(ref
System.Net.CallbackClosure closure = null) + 0x69 bytes
System.dll!System.Net.Sockets.Socket.BeginReceive(byte[] buffer, int offset,
int size, System.Net.Sockets.SocketFlags socketFlags, out
System.Net.Sockets.SocketError errorCode, System.AsyncCallback callback,
object state) + 0x14d bytes
System.dll!System.Net.Sockets.Socket.BeginReceive(byte[] buffer, int offset,
int size, System.Net.Sockets.SocketFlags socketFlags, System.AsyncCallback
callback, object state) + 0x23 bytes
MyApp.exe!MyApp.MStore.WorkerThread() Line 625 + 0x38 bytes C#