Solved

Check if named pipe exists

Posted on 2010-08-30
2
2,939 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

770 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