Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!stealth.acf.nyu.edu!brnstnd From: brnstnd@stealth.acf.nyu.edu Newsgroups: comp.unix.questions Subject: Re: non-blocking sockets Message-ID: <7224:Apr1422:40:0490@stealth.acf.nyu.edu> Date: 14 Apr 90 22:40:04 GMT References: <28080@ut-emx.UUCP> Reply-To: brnstnd@stealth.acf.nyu.edu (Dan Bernstein) Distribution: usa Organization: IR Lines: 16 In article <28080@ut-emx.UUCP> ycy@walt.cc.utexas.edu (Joseph Yip) writes: > I am writing some socket programs. Everything works fine except when I > want my socket to be NON-BLOCKING. If the file descriptor may be shared between processes, none of the techniques for non-blocking I/O mentioned in other messages will work, because they use fcntls that are per-fd rather than per-process. Under BSD 4.3 you can use siginterrupt() and signals to customize the amount of blocking to your taste, whether you're using sockets or not. This is illustrated by multitee, appearing soon in a source group near you. If you want asynchronous I/O---i.e., nonblocking I/O plus threads---you can fork off separate processes, use select/signal/SIGALRM creatively, or do whatever else suits your taste. ---Dan