DosConnectNmPipe

From EDM2
Jump to: navigation, search

This call is issued by the server process and enables the named pipe to be opened by a client.

Syntax

DosConnectNmPipe (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
  • 95 ERROR_INTERRUPT
  • 109 ERROR_BROKEN_PIPE
  • 230 ERROR_BAD_PIPE
  • 233 ERROR_PIPE_NOT_CONNECTED

Remarks

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.

Bindings

C

#define INCL_DOSNMPIPES

USHORT  rc = DosConnectNmPipe(Handle);
HPIPE      Handle;        /* Pipe handle */
USHORT     rc;            /* return code */

MASM

EXTRN  DosConnectNmPipe:FAR
INCL_DOSNMPIPES     EQU 1

PUSH   WORD Handle           ;Pipe handle
CALL   DosConnectNmPipe

Returns WORD