Solved

Check if named pipe exists

Posted on 2010-08-30
2
2,793 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
Comment Utility
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
Comment Utility
Ok, if there is no other way
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now