DosDisConnectNmPipe

From EDM2
Jump to: navigation, search

This call forces a named pipe to close.

Syntax

DosDisConnectNmPipe (Handle)

Parameters

Handle (HPIPE) - input 
Handle of the named pipe that is returned by DosMakeNmPipe.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 109 ERROR_BROKEN_PIPE
  • 230 ERROR_BAD_PIPE

Remarks

The server process of a named pipe issues DosDisConnectNmPipe followed by DosConnectNmPipe to prepare the pipe for the next client.

If the client end of the pipe is open when DosDisConnectNmPipe is issued, it is forced to close, and the client gets an error code on its next operation. Forcing the client end to close may cause data to be discarded that has not yet been read by the client. If the client end is currently closing (DosClose has been issued), DosDisConnectNmPipe acknowledges the close and makes the pipe available to be opened by the next client after a DosConnectNmPipe is issued.

A client that gets forced off a pipe by a DosDisConnectNmPipe must issue DosClose to free the handle resource. Although DosDisConnectNmPipe makes the client's handle invalid, it does not free the client's handle.

Any threads that are blocked on the pipe are awakened by DosDisConnectNmPipe. A thread blocked on the pipe by a DosWrite returns ERROR_BROKEN_PIPE. A thread blocked on the pipe by a DosRead returns BytesRead = 0, indicating EOF.

Bindings

C

#define INCL_DOSNMPIPES

USHORT  rc = DosDisConnectNmPipe(Handle);

HPIPE   Handle;        /* Pipe handle */
USHORT  rc;            /* return code */

MASM

EXTRN  DosDisConnectNmPipe:FAR
INCL_DOSNMPIPES     EQU 1

PUSH   WORD    Handle        ;Pipe handle
CALL   DosDisConnectNmPipe

Returns WORD