home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.protocols.tcp-ip      TCP and IP network protocols.      14,669 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 13,080 of 14,669   
   Barry Margolin to Rick Jones   
   Re: how to make sure if there is data in   
   05 Oct 09 17:03:22   
   
   From: barmar@alum.mit.edu   
      
   In article ,   
    Rick Jones  wrote:   
      
   > David Schwartz  wrote:   
   > > On Oct 5, 2:21?am, GSA  wrote:   
   >   
   > > > I have a requirement wherein I need to check if data is there on   
   > > > the channel and read it when it is there.   
   >   
   > > > Please let me know if it is possible to check if data is there on   
   > > > the channewl and preoceed with reading the channel only when data   
   > > > is there.   
   >   
   > > Simply attempt to read from the channel using a non-blocking read. If   
   > > you get data, then there was data on the channel. There is no good way   
   > > to know that there is data on the channel without attempting to read   
   > > from the channel.   
   >   
   > 99 times out of 10 I have found select() or poll() "good enough."   
      
   You could also use the FIONREAD ioctl, which returns how much data is   
   buffered.  If it's non-zero, data is there.   
      
   --   
   Barry Margolin, barmar@alum.mit.edu   
   Arlington, MA   
   *** PLEASE don't copy me on replies, I'll read them in the group ***   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca