Path: utzoo!mnetor!tmsoft!torsqnt!hybrid!scifi!bywater!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.unix.wizards Subject: Re: Unblocking filedescriptor(s) Keywords: fcntl,ioctl Message-ID: <120184@uunet.UU.NET> Date: 27 Jan 91 06:25:43 GMT References: <1991Jan25.235221.21868@odin.diku.dk> Organization: UUNET Communications Services, Falls Church, VA Lines: 22 In article <1991Jan25.235221.21868@odin.diku.dk> cthulhu@freja.diku.dk (Stefan Krabbe) writes: >I am programming in a 4.3BSD environment... > In a program I am currently writing I make a filedescriptor unblocking >this way: > fcntl(filedescriptor, F_SETFL, FNDELAY); What you really want to do to make it unblocking is something like: flags = fcntl(fd, F_GETFL, 0); /* get old flags */ flags |= FNDELAY; /* add no delay */ fcntl(fd, F_SETFL, flags); /* set new flags */ Your code sets the flags to FNDELAY, and clears any existing flags. My code adds FNDELAY to the existing flag set. > But what do I do if I want it make it blocking again? I think you can take it from here. -- Root Boy Jim Cottrell Close the gap of the dark year in between