home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3851 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.5 KB

  1. Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!sawdust.sawmill.uucp!rjk
  2. From: rjk@sawdust.sawmill.uucp
  3. Newsgroups: comp.unix.programmer
  4. Date: 16 Jul 92 09:39 MDT
  5. Subject: Re: Bidirectional Pipes
  6. Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
  7. Message-ID: <RJK.92Jul16093905@sawdust.sawmil>
  8. References: <1992Jul13.175933.26213@dragon.ac>
  9. Nf-ID: #R:1992Jul13.175933.26213@dragon.ac:1952253999:RJK.92Jul16093905@sawdust.sawmil:-328824565:001:989
  10. Nf-From: sawdust.sawmill.uucp!rjk    Jul 16 09:39:00 1992
  11. Lines: 28
  12.  
  13.  
  14. In article <1992Jul14.061826.11689@Unibase.SK.CA> roe@Unibase.SK.CA (Roe Peterson) writes:
  15.  
  16.    890025d@dragon.acadiau.ca (Andy DeWolfe) writes:
  17.  
  18.    >Can anyone provide examples/references/information on setting up
  19.    >bidirectional pipes using "C"/Unix?
  20.  
  21.    Sorry, but there is no such beastie as a bi-directional pipe.  The
  22.    pipe(2) system call will return two file descriptors, one open for
  23.    write, and one open for read.  Have the reader close the write end, and
  24.    the writer close the read end.
  25.  
  26.    You can't use pipe to communicate in both direction over one file
  27.    descriptor.
  28.  
  29. Actually, all pipes under System V R4 are bidirectional.  From pipe(2):
  30.  
  31. "pipe creates an I/O mechanism called a pipe and returns two file
  32. descriptors, fildes[0] and fildes[1].  The files associated with fildes[0]
  33. and fildes[1] are streams and are both opened for reading and writing."
  34. --
  35. Rich Kuhns            {uunet,nstar}!sawmill!rjk
  36. PO Box 6249
  37. 100 Sawmill Road
  38. Lafayette, IN  47903
  39. (317)477-6000 (days)
  40.  
  41.