I am working on Com Server and client Communication and i got a problem while creating File on a named pipe.
The scenario is Like This,
1. Com Server Creates a named pipe.
hWritePipe = CreateNamedPipe( PIPE_NAME, PIPE_ACCESS_DUPLEX , PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_NOWAIT, PIPE_UNLIMITED_INSTANCES, PIPE_BUFFER_SIZE, PIPE_BUFFER_SIZE PIPE_TIMEOUT, NULL); ConnectNamedPipe(hWritePipe, NULL);
2. Client1 open the com server and gets the pipe name and opens it with CreateFile as follows,
handle1 = CreateFile( m_chWritePipeName, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
// no template file
handle1 is proper and we are able to communicate with server
3. Open the second instance of same client say client2.Client2 also gets the pipe name and tries to open(Same CreateFile call) the pipe.But in this case we are getting Invalid handle and GetLastError() is 0xe7(All pipe instances are busy).
Is it possible to open the Named pipe by multiple process?
Thanks in advance.