DosConnectNPipe is issued by a server process to put a named pipe into the listening state. This enables a client process to gain access to the pipe by calling DosOpen.

If the client end of the pipe is already open when DosConnectNPipe is issued, DosConnectNPipe returns immediately and has no effect. If the client end is closed, the result depends on whether the pipe is in blocking mode or nonblocking mode. (Blocking/nonblocking mode is specified when the pipe is created; it can also be changed by DosSetNPHState).

Multiple DosConnectNPipe calls can be issued for a pipe that is in nonblocking mode. If the pipe is not already either open or closing, the first call to DosConnectNPipe puts the pipe into the listening state; subsequent calls merely test the pipe state.

If the pipe was previously opened and then closed by a client, but has not yet been disconnected by the server, DosConnectNPipe returns ERROR_BROKEN_PIPE.

If the function is interrupted while it is waiting for a client to open the pipe, ERROR_INTERRUPT is returned.

If DosConnectNPipe is called by a client process, ERROR_BAD_PIPE is returned.

Also, ERROR_BAD_PIPE is returned if you specify an invalid name or file handle.


[Back] [Next]