This call is issued by the server process and enables the named pipe to
be opened
by a client.
DosConnectNmPipe
Handle (HPIPE) - input
The server process, which creates the named pipe with DosMakeNmPipe, prepares the pipe so that it can accept a DosOpen from a client. To prepare the pipe for its first client, the server issues DosConnectNmPipe. To prepare the pipe for the next client, the server issues DosDisConnectNmPipe followed by DosConnectNmPipe.
When DosConnectNmPipe returns, the pipe is in a listening state. A DosOpen to a pipe that is not in a listening state fails. A client can determine the pipe's state by issuing DosPeekNmPipe.
If the client end of the pipe is currently open, DosConnectNmPipe returns immediately and has no effect. If the client end is not open, DosConnectNmPipe either waits until it is open (if blocking mode is set) or else returns immediately with ERROR_PIPE_NOT_CONNECTED (if non-blocking mode is set). In the case where ERROR_PIPE_NOT_CONNECTED is returned, the pipe enters a listening state, permitting a client to issue a successful DosOpen.
If the pipe has been closed by a previous client but is not disconnected by the server, DosConnectNmPipe always returns ERROR_BROKEN_PIPE. Multiple DosConnectNmPipe calls can be issued in non-blocking mode; the first one puts the pipe into a listening state (if it is not already open or closing), and subsequent ones simply test the pipe state.
If DosConnectNmPipe is called by the client end of the pipe, ERROR_BAD_PIPE is returned. If the wait (in blocking mode only) for the client open is interrupted, the ERROR_INTERRUPT is returned.