Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Check if named pipe exists

Posted on 2010-08-30
2
2,995 Views
Last Modified: 2013-12-04
Hi,

How to check if named pipe exists? (CreateNamedPipe is not called)?
0
Comment
Question by:lavitz
2 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
ID: 33561736
The file  exists or not.
Check if that's what you need:
MSDN. http://msdn.microsoft.com/en-us/library/aa365592(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa365592(VS.85).aspx

There is a sample with a loop waiting for a named pipe:
LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe");
HANDLE hPipe;

while (1)
{
   hPipe = CreateFile( lpszPipename,  GENERIC_READ | GENERIC_WRITE,  0,  
         NULL, OPEN_EXISTING,   0, NULL);          
    if (hPipe != INVALID_HANDLE_VALUE)
         break;
 
    if (GetLastError() != ERROR_PIPE_BUSY)
    {
         _tprintf( TEXT("Could not open pipe. GLE=%d\n"), GetLastError() );
         return -1;
    }

   // wait, etc.
}
0
 

Author Closing Comment

by:lavitz
ID: 33575869
Ok, if there is no other way
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question