From: "Ara.T.Howard" Date: 2004-06-09T09:03:38+09:00 Subject: Re: oddities with select On Wed, 9 Jun 2004, Ben Giddings wrote: > I'm trying to use Ruby to talk to an network application, and noticed > something odd. Using ethereal, I can see that the server is returning a > newline to the client, however my Ruby code, calling select([socket], > [], [], 0.1) repeatedly for 5 seconds never seems to know that there's > data to be read. > > I've tried to make sure the socket is non-blocking with: > > @sock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) > > But that seems to have no effect. > > Is there something I'm missing? don't you want to block? i mean, isn't that why you are using select? to do nothing until data arrives? if it IS blocking your code should sleep untill data becomes available. also, i'm not sure what the buffering semantics of select are - but i'm sure there are some - might want to check that out too... > I haven't tried the same code in another language to see if the problem > may be there. At the moment though, this seems broken. > > Any ideas? > > Ben > > > -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; and a weed grows, even though we do | not love it. --Dogen ===============================================================================