Re: name pipe problem, quick question

From: Lew Pitcher (Lew.Pitcher_at_td.com)
Date: 06/11/04


Date: Fri, 11 Jun 2004 15:06:44 -0400


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

187 wrote:

> "Richard Tobin" <richard@cogsci.ed.ac.uk> wrote in message
> news:cacln2$7j6$1@pc-news.cogsci.ed.ac.uk...
>
>>In article <2itvdsFqt04iU1@uni-berlin.de>,
>>187 <bigal187.invalid@adexec.com> wrote:
>>
>>
>>>>>rm $b/cmd-1
>>>>>mkfifo $b/cmd-1
>>>>>rm $b/res-1
>>>>>mkfifo $b/res-1
>>>>
>>>> [...]
>>>>
>>>>>echo "" > $b/cmd-1&
>>
>>>>your script stops here, waiting for something to open $b/cmd-1 for
>>>>reading.
>>
>>>How can I fix the problem? Any suggestions?
>>
>>Don't write to the named pipes until the program is listening on them.
>
>
> I'm not entirely sure what I'm doing (I've never worked with named pipes
> before), could you please elaborate a little? What do you mean exactly?

Unless the programs handle named pipes with special settings
(O_NONBLOCK, IIRC), you get blocking behaviour by default.

A named pipe can have multiple writers, but only one reader. Any process
that opens the pipe for writing blocks until the pipe has also been
opened for reading. Any process that opens the pipe for reading blocks
on the first read until the pipe has been opened for writing.

The only way around this is to open the pipe in non-blocking mode, and
you can't do this in a script.

- --

Lew Pitcher, IT Consultant, Enterprise Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFAygLCagVFX4UWr64RAkNfAKDqf4IpcMR34/+SXCo2JIHO6uuT7ACfa4S7
GYvOhWNRxjhXZBxiCqzYMEM=
=InmX
-----END PGP SIGNATURE-----



Relevant Pages

  • [Full-disclosure] RE: Windows PHP 4.x "0-day" buffer overflow
    ... I believe using named pipes on windows has ALWAYS been known for MANY YEARS ... What this has to do with PHP I'm not certain either as this seems to ... > Where "pipe" is the named pipe to use. ...
    (Full-Disclosure)
  • Re: name pipe problem, quick question
    ... >>Don't write to the named pipes until the program is listening on them. ... A named pipe can have multiple writers, ... Any process that opens the pipe for reading blocks ... Enterprise Technology Solutions, TD Bank Financial Group ...
    (comp.os.linux.misc)
  • Re: name pipe problem, quick question
    ... >>Don't write to the named pipes until the program is listening on them. ... A named pipe can have multiple writers, ... Any process that opens the pipe for reading blocks ... Enterprise Technology Solutions, TD Bank Financial Group ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Named pipes disabled but still getting named pipe connections! Why
    ... You might be seeing shared memory connections that are local to the machine. ... Shared memory is a local pipe, and it shares some of the named pipes code ... and yet we continue to see named pipe connections in the Activity ...
    (microsoft.public.sqlserver.connect)
  • Re: "Talking" to a "busy" application
    ... you could have multiple instances ... This sounds a lot like a pipe. ... Named pipes are explicitly created. ... want/need the communication channel to hang onto ...
    (comp.arch.embedded)