开发者

Best practice for blocking mode of listening socket and client socket?

开发者 https://www.devze.com 2023-03-07 10:20 出处:网络
listening socket is responsib开发者_如何学Cle for accepting new coming client socket : sock_client = accept(sock_listen, NULL, NULL)

listening socket is responsib开发者_如何学Cle for accepting new coming client socket :

sock_client = accept(sock_listen, NULL, NULL)

In a typical C/S application,what's the best choice of blocking mode of listening socket and client socket?


If you are threaded and can devote a thread to a socket, then blocking. If you are not, then on the server non-blocking. On the client it depends if you have something better to do. Blocking if not, non-block if you do.

0

精彩评论

暂无评论...
验证码 换一张
取 消