首页 > 解决方案 > When using .Net asynchronous sockets, which thread are callbacks called from?

问题描述

When you use asynchronous methods like Socket.BeginConnect and Socket.BeginReceive you pass an AsyncCallback delegate.

When these delegates are called, are they called from one of the internal thread-pool threads, or a temporary thread? I was thinking for instance in the case you are running a server, if you start doing logic in your callback implementation and don't return, will you exhaust the threadpool after a few connections are accepted since you are 'stealing' the thread?

标签: .netnetwork-programmingasyncsocket

解决方案


推荐阅读