Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impact of using select with blocking and non-blocking sockets

How will my program differ in behavior if I use non-blocking sockets with a select() call as opposed to using blocking sockets with a select() call?

like image 671
DaTaBomB Avatar asked Oct 19 '25 15:10

DaTaBomB


2 Answers

The select polling will not behave differently, only the receive/send functionality will differ between blocking/non-blocking sockets.

like image 120
Some programmer dude Avatar answered Oct 22 '25 06:10

Some programmer dude


select() won't behave differently. read(), write(), accept() and other I/O functions will -- they will never block on non-blocking sockets, while they might block even if select() tells they would not, although this is somewhat rare.

https://stackoverflow.com/a/5352634/259543

Not sure whether this behavior is allowed by POSIX, though.

like image 23
alecov Avatar answered Oct 22 '25 05:10

alecov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!