Thread: Pipes!

  1. #1
    Registered User
    Join Date
    Nov 2007


    When is it a good situation to use an ordinary pipe and when is it a good situation to use a named pipe?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Named pipes are available to "any" application to connect to at "any time".

    Regular pipes are only available when the application that creates the pipe also creates the child process.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Check this site out

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Portland, OR
    Named pipes are usually used to "trick" some program into reading from a pipe, when it is normally set up to read from a file in the filesystem. If some program, call it A, wants to read from a file, but you want to instead pipe some input into it, then you can create a named pipe and tell program A to read from that.

    There are certain limitations. For instance, pipes are not seekable, so if process A attempts to seek, it will fail if you pass a pipe to it. And if process A attempts to stat() its input, because for instance it wants to determine file size, it will not receive meaningful data. It goes on and on -- if process A attempts to close and then reopen the pipe (not an unusual state of affairs for a program which expects its input to come from a "real" file) then things will not behave normally.

    Normally, pipes, are created with the pipe() function, and are intimately related between parent and child process. Named pipes are only used in very special circumstances.
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);

  5. #5
    Registered User
    Join Date
    Nov 2007
    What would be a simple real world scenario(s) in which I would want to use each of the types
    Last edited by NuNn; 03-11-2009 at 06:33 AM.

  6. #6
    Registered User
    Join Date
    Nov 2007
    Any suggestions?

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    There really is no punchline?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pipes sometimes fail
    By EVOEx in forum Linux Programming
    Replies: 2
    Last Post: 05-02-2009, 01:47 PM
  2. Pipes
    By Martin Kovac in forum C Programming
    Replies: 1
    Last Post: 03-31-2009, 03:09 AM
  3. pipes in c
    By ajal1 in forum C Programming
    Replies: 6
    Last Post: 10-29-2005, 03:29 PM
  4. Need some help with pipes please.
    By carrja99 in forum C Programming
    Replies: 1
    Last Post: 05-05-2004, 04:13 PM
  5. Services and Pipes
    By nickname_changed in forum Windows Programming
    Replies: 0
    Last Post: 07-16-2003, 06:46 AM