DosPeekNPipe examines the current contents of a named pipe without removing it. It also returns information about the state of the pipe.

DosPeekNPipe never blocks, even if the pipe is in blocking mode; if the pipe cannot be accessed immediately, ERROR_PIPE_BUSY is returned. Because this function does not block, it returns only what is currently in the pipe. Thus, if a message pipe is being examined, only a portion of a message may be returned, even though the specified buffer length could accommodate the entire message.

The value returned in pState can be used by the client or the server to determine the current state of the pipe and to take appropriate action.

Clients of named pipes created with the NP_ACCESS_INBOUND access mode cannot use the DosPeekNPipe function. If the named pipe's client uses the DosPeekNPipe function, the function returns error code ERROR_ACCESS_DENIED.


[Back] [Next]