[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: socket select() question
- From: Edwin Eyan Moragas <haaktu@...>
- Date: Tue, 13 Dec 2005 14:38:17 +0800
> > select() accepts a two tables. one for those that can be wriiten to
> > without blocking and another that can be read fronm without blocking.
>
> You shouldn't think about it like this. Unless you put your socket in
> non-blocking mode, you will end up blocked. One day you will ask for one
> extra byte and block, or try to write one extra byte and block. So the
> idea is to place the sockets in non-blocking mode, use select to block
> you until something interesting happens, and then try to read or write.
> If it fails with timeout, you call select again to block until something
> interesting happens. Then you just try again. Select allows you to avoid
> a busy wait, got it?
>
i got this one.
the premise i was working on was wrong. it should be after calling select,
i should have some set of descriptors which are readable and/or writeable,
if there are any.
thank you.
--
salud,
eyan
http://www.eyan.org