I am using ThreadPool
to handle every connected Socket in my Socket Server separately. However i wonder if the callback of BeginReceive also gets execute inside the ThreadPool
ThreadPool.QueueUserWorkItem(o =>
{
if (ClientExchange != null && ClientExchange(asynchronousState)) {
if (ClientConnect != null) {
ClientConnect(asynchronousState);
}
}
ConnectedClients.Add(ipEndPoint, socket);
socket.BeginReceive(asynchronousState.Buffer, 0, asynchronousState.Buffer.Length, SocketFlags.None, HandleAsyncReceive, asynchronousState);
});
Does the HandleAsyncReceive
callback gets also executed in the new Thread (which was grabbed by the ThreadPool) ?