Help with select
Stan Friesen
sarima at gryphon.CTS.COM
Mon Mar 21 10:11:04 AEST 1988
In article <12404 at brl-adm.ARPA> doug at ws5.cis.temple.edu (Doug Bagley) writes:
>I am trying to learn how to use sockets in Ultrix 2.0 at a site with no
>sources. My problem is with the select function. When I provide the
>readfds and writefds parameters to the select function, only the writefds
>parameter gets changed whether or not the process on the other end of the
>socket is doing a read or a write. Strangely enough, if I make the
>writefds NULL or 0, and if the remote process is only writing to this
>one, everything works fine -- the remote process' writes show up in the
>readfds (telling the selecting process that it can read).
I think you may have a sligght misunderstanding of what a select()
on a write fd means. It means block until there is enough system buffer
space to successfully complete a write on the fd. Since it is almost always
true that there is sufficient buffer space for a write to succeed a select()
on a writefds will almost always return immediately with the writefds altered.
I suspect what you want is to wait until the consumer has read what you last
wrote. This is rather difficult to do, and I will not go into it here.
SIGH, select() may well be the BSD feature that I miss the most
on System V UNIX. Does Sys 5 release 3 have it or its equivalent?
More information about the Comp.unix.wizards
mailing list