Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucsd!ucrmath!yakker From: yakker@ucrmath.UCR.EDU (matt robinson) Newsgroups: comp.unix.questions Subject: Re: Polling on a socket without select()... Summary: You should stick to select(). Message-ID: <2473@ucrmath.UCR.EDU> Date: 10 Nov 89 01:56:45 GMT References: <2065@cunixc.cc.columbia.edu> Reply-To: yakker@ucrmath.UUCP (Matt Robinson) Followup-To: yakker@ucrmath.ucr.edu Organization: University of California, Riverside Lines: 22 In article 2065, micky@cunixc.cc.columbia.edu (Micky Liu) writes: >I am writing a program that needs to effect a poll on a udp/ip socket. I am >using recvfrom(2) to read data, but I would like it to return immediately if >there is no data ready... My SunOS4.x man page says that there is a method >to make the recvfrom() call return immediately using ioctl(2) to set the >socket to non-blocking... I have looked in and >but have not found any ioctl capable of doing this... You could set the ioctl to non-blocking without having to check the socket just once, but if you are looking for the long run, I would suggest using select to check for data, especially if you are looking to delay for any length of time, and would like to repeat the procedure. ---------------------------------------*-------------------------------------- "Behold, God, is my salvation, I | Internet: yakker@ucrmath.ucr.edu will trust, and not be afraid.." |+| UUCP: ...ucsd!ucrmath!yakker |+|+| "What lies behind you and what lies |+|+| The University of California before you pales insignificant when |+| at Riverside compared to what lies within you.." | Department of Computer Science ---------------------------------------*--------------------------------------