Callbacks are independent because they are called on the thread I / O work starts.
If you're interested, you can see this in the source code . This particular method is for the Socket class (which TcpClient and UdpClient are used internally), where overlapping IO is used to call the callback (see Comment on top of asyncResult.SetUnmanagedStructures invocation:
private void DoBeginReceiveFrom(byte[] buffer, int offset, int size, SocketFlags socketFlags, EndPoint endPointSnapshot, SocketAddress socketAddress, OverlappedAsyncResult asyncResult) { EndPoint oldEndPoint = m_RightEndPoint; SocketError errorCode = SocketError.SocketError; try {
source share