BOOL SetNamedPipeHandleState(hNamedPipe, lpdwMode, lpcbMaxCollect, lpdwCollectDataTimeout) | |||||
HANDLE hNamedPipe; | /* named-pipe handle | */ | |||
LPDWORD lpdwMode; | /* specifies new pipe mode | */ | |||
LPDWORD lpcbMaxCollect; | /* max bytes before remote transmission | */ | |||
LPDWORD lpdwCollectDataTimeout; | /* max time before remote transmission | */ |
The SetNamedPipeHandleState function is used to set the read mode and the blocking mode of a named pipe. On the client end of a remote named pipe this function can also control local buffering.
hNamedPipe
Specifies a handle to the named pipe. The handle must have GENERIC_WRITE access to the named pipe.
lpdwMode
Points to a DWORD which supplies the new mode. The mode is a combination of a read-mode flag and a wait flag. May be NULL if the mode is not being set. The following values may be used:
Value | Meaning |
PIPE_READMODE_BYTE | ||
Read pipe as a byte stream. | ||
PIPE_READMODE_MESSAGE | ||
Read pipe as a message stream. If this flag is not set, pipe is read as a byte stream. | ||
PIPE_WAIT | ||
Blocking mode is to be used for this handle. | ||
PIPE_NOWAIT | ||
Nonblocking mode is to be used for this handle. If this flag is not set, blocking mode is used. |
lpcbMaxCollect
Points to a variable that specifies the maximum number of bytes that will be collected on the client machine before transmission to the server. This parameter must be NULL on a handle to the server end of a named pipe or when client and server applications are on the same machine. This parameter is ignored if the client specified write through when the handle was created, and may be NULL if the collection count is not being set.
lpdwCollectDataTimeout
Points to a variable that specifies the maximum time (in milliseconds) that can pass before a remote named pipe transfers information over the network. This parameter must be NULL if the handle is for the server end of a named pipe or when client and server applications are on the same machine. This parameter is ignored if the client specified write through when the handle was created, and may be NULL if the collection timeout is not being set.
The return value is TRUE if the function was successful, or FALSE if an error occurred. To obtain extended error information, use the GetLastError function.
CreateNamedPipe, GetNamedPipeHandleState