Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!apple!rutgers!cmcl2!stealth.acf.nyu.edu!brnstnd From: brnstnd@stealth.acf.nyu.edu Newsgroups: comp.unix.questions Subject: Re: How to do a non-blocking write of more than one char? Message-ID: <5564@stealth.acf.nyu.edu> Date: 10 Jan 90 22:23:33 GMT References: <2759@stealth.acf.nyu.edu> <2799@auspex.auspex.com> Reply-To: brnstnd@stealth.acf.nyu.edu (Dan Bernstein) Distribution: usa Organization: IR Lines: 24 In article <2799@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: > It's > guaranteed that you can write *some* amount of data without blocking, > but no guarantee as to how much is made, in general. Can you show me a program that blocks on a write() after select() has indicated that the descriptor is writable? (select() on this machine is slightly buggy, so I'm not sure my tests are accurate.) > Sorry, but you > really *are* expected to use non-blocking I/O in that case.... Okay, Guy, tell me how I accomplish this: Process A writes data to a pipe connected to Process B. Process A must not block on its writes, because it has to handle other descriptors as well. Process B is an already-written program that assumes that its reads are non-blocking; it'll take EWOULDBLOCK as a read error and die horribly. Process A can avoid blocking by using select() and writing just one character at a time. Is there any other way? C'mon, guys, this is a simple question! ---Dan