4

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?

rtruszk
  • 3,902
  • 13
  • 36
  • 53
DaTaBomB
  • 623
  • 3
  • 11
  • 23

2 Answers2

7

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

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • So it does not make sense to use blocking sockets with a select call , right? Or is there a use case for this? – DaTaBomB Feb 24 '13 at 17:40
4

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.

Community
  • 1
  • 1
alecov
  • 4,882
  • 2
  • 29
  • 55