DosDisConnectNPipe is issued by a server process to acknowledge that a client process has closed a named pipe. (If a client process tries to issue DosDisConnectNPipe, ERROR_BAD_PIPE is returned.) The pipe cannot be opened by another client process until the server process issues this function, followed by DosConnectNPipe.

Until the client's close has been acknowledged, the server process will receive a value of zero for pcbActual (indicating end-of-file) if it tries to read from the pipe, and ERROR_BROKEN_PIPE if it tries to write to it. Clients that attempt to open the pipe receive ERROR_PIPE_BUSY.

Any threads that are blocked on the pipe are awakened by DosDisConnectNPipe. A thread that is blocked on a DosWrite request returns ERROR_BROKEN_PIPE. A thread that is blocked on a DosRead request returns a value of zero for pcbActual.

If the client end of the pipe is open when DosDisConnectNPipe is issued, it is forced to close, and the client receives an error code on its next operation. Note that when a client is forced to close in this manner, data may be discarded before it has been read by the client.

DosDisConnectNPipe makes the client's handle invalid, but it does not free the handle. Therefore, a client that is forced off a pipe by DosDisConnectNPipe must still issue DosClose to free the handle resource.

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


[Back] [Next]