简体   繁体   中英

Does socket.listen(0); pause a thread?

I am thinking of having socket.listen() on a separate thread for my server, does it pause the thread?

I want to have my thread to listen, talk with the client, end client connection, listen again.

The Listen method does not block the current thread, it merely sets up the Socket to accept new connections. Methods like Accept in synchronous mode will block the thread until a connection is received.

Note: The MSDN documentation for methods on Socket are pretty good about listing whether or not they block in the Remarks section. Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM