Re: Question on select() and sockets
- From: Alex Fraser <me@xxxxxxxxxxx>
- Date: Fri, 06 Jun 2008 22:07:36 +0100
K-mart Cashier wrote:
Why do sockets have to be 'non-blocking' when using select() to set
the timeout? Ie, why can't they be blocked?
You can use blocking calls to send()/recv()/read()/write() if you don't care if you block in them - but I don't think that should ever be the case if you are using select().
Making the sockets non-blocking guarantees control over when you block (ie, in select()). Although I was writing about pipes in my recent reply to Edd, the same applies to sockets (first block of my reply):
http://groups.google.co.uk/group/comp.unix.programmer/msg/b589bcb9068e0420
Alex
.
- Follow-Ups:
- Re: Question on select() and sockets
- From: K-mart Cashier
- Re: Question on select() and sockets
- References:
- Question on select() and sockets
- From: K-mart Cashier
- Question on select() and sockets
- Prev by Date: Re: how to fork/exec and not wait for child
- Next by Date: Re: how to fork/exec and not wait for child
- Previous by thread: Question on select() and sockets
- Next by thread: Re: Question on select() and sockets
- Index(es):
Loading