select() and fd_set *exceptfds - Unix

This is a discussion on select() and fd_set *exceptfds - Unix ; Richard Stevens in ``UNIX Network Programming'' claims that there are two reasons for a file descriptor to cause select to warn the caller through ``exceptfds''; they are out-of-band data and another cause which is related to pseudo-terminals. It seems to ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: select() and fd_set *exceptfds

  1. select() and fd_set *exceptfds

    Richard Stevens in ``UNIX Network Programming'' claims that there are
    two reasons for a file descriptor to cause select to warn the caller
    through ``exceptfds''; they are out-of-band data and another cause which
    is related to pseudo-terminals.

    It seems to me then that if an application does not make use, in any
    way, of MSG_OOB and does not deal with pseudo-terminals at all, then
    such application will never see these exceptions on a socket --- on UNIX
    systems.

    Or is it possible that anything else causes select to set exceptfds? Any
    information is appreciated. Thank you.

  2. Re: select() and fd_set *exceptfds

    On Nov 8, 6:22 pm, dbas...@yahoo.com.br (Daniel C. Bastos) wrote:

    > It seems to me then that if an application does not make use, in any
    > way, of MSG_OOB and does not deal with pseudo-terminals at all, then
    > such application will never see these exceptions on a socket --- on UNIX
    > systems.


    Right. Cases where you need to handle these kinds of exceptional
    events are so rare the vast majority of programmers will never
    encounter them.

    > Or is it possible that anything else causes select to set exceptfds? Any
    > information is appreciated. Thank you.


    Sure, but if you don't know of a particular case, there's no reason to
    test for it. What would you do if you got one anyway?

    Adding a socket to an fd set that you pass to select implies that you
    have a particular function call in mind should you get a hit. If you
    have no particular function in mind, there's no point in putting the
    socket in the set.

    Implementations may define exceptional events for things other than
    normal files or sockets (for example, devices) and programs that
    understand that interface would know what to do if they get a hit.

    DS


+ Reply to Thread