DosSetNmPHandState: Difference between revisions
Appearance
m Ak120 moved page OS2 API:CPI:LEGACY:DosSetNmPHandState to DosSetNmPHandState |
mNo edit summary |
||
Line 1: | Line 1: | ||
This call sets the read and blocking modes of a named pipe. | This call sets the read and blocking modes of a named pipe. | ||
==Syntax== | ==Syntax== | ||
DosSetNmPHandState (Handle, PipeHandleState) | |||
DosSetNmPHandState | |||
==Parameters== | ==Parameters== | ||
; | ;Handle (HPIPE) - input : Handle of the named pipe returned by DosMakeNmPipe or DosOpen. | ||
;PipeHandleState (USHORT) - input : Named pipe handle state, consists of the following bit fields: | |||
; PipeHandleState (USHORT) - input : Named pipe handle state, consists of the following bit fields: | :15 - Blocking flag: | ||
::0 = Reads /Writes block if no data available. | |||
::1 = Reads/Writes return immediately if no data available. | |||
::Reads normally block until at least partial data can be returned. Writes by default block until all bytes requested have been written. | |||
::Non-blocking mode (B = 1) changes this behavior as follows: | |||
::*DosRead - Returns BytesRead = 0 if no data is available. | |||
::*DosWrite - Returns BytesWritten = 0 if there is not enough buffer space available in the pipe. Otherwise, the entire data area is transferred. | |||
:14-10 - Reserved and must be set to zero. | |||
:9-8 - Read Mode flag: | |||
::00 = Read pipe as byte stream. | |||
::01 = Read pipe as a message stream. | |||
:7-0 - Reserved and must be set to zero. | |||
==Return Code== | ==Return Code== | ||
rc (USHORT) - return | rc (USHORT) - return | ||
Return code descriptions are: | Return code descriptions are: | ||
* 0 NO_ERROR | * 0 NO_ERROR | ||
* 87 ERROR_INVALID_PARAMETER | * 87 ERROR_INVALID_PARAMETER | ||
Line 40: | Line 28: | ||
* 231 ERROR_PIPE_BUSY | * 231 ERROR_PIPE_BUSY | ||
* 233 ERROR_PIPE_NOT_CONNECTED | * 233 ERROR_PIPE_NOT_CONNECTED | ||
==Remarks== | ==Remarks== | ||
The read mode and blocking/non-blocking mode of a named pipe can be changed. The pipe mode can not be changed to non-blocking when another thread is blocked on an I/O to the same end of the pipe. | The read mode and blocking/non-blocking mode of a named pipe can be changed. The pipe mode can not be changed to non-blocking when another thread is blocked on an I/O to the same end of the pipe. | ||
==Example Code== | ==Example Code== | ||
=== C Binding=== | === C Binding=== | ||
Line 68: | Line 58: | ||
* | * | ||
[[Category: | [[Category:Dos]] |
Revision as of 00:57, 27 February 2017
This call sets the read and blocking modes of a named pipe.
Syntax
DosSetNmPHandState (Handle, PipeHandleState)
Parameters
- Handle (HPIPE) - input
- Handle of the named pipe returned by DosMakeNmPipe or DosOpen.
- PipeHandleState (USHORT) - input
- Named pipe handle state, consists of the following bit fields:
- 15 - Blocking flag:
- 0 = Reads /Writes block if no data available.
- 1 = Reads/Writes return immediately if no data available.
- Reads normally block until at least partial data can be returned. Writes by default block until all bytes requested have been written.
- Non-blocking mode (B = 1) changes this behavior as follows:
- DosRead - Returns BytesRead = 0 if no data is available.
- DosWrite - Returns BytesWritten = 0 if there is not enough buffer space available in the pipe. Otherwise, the entire data area is transferred.
- 14-10 - Reserved and must be set to zero.
- 9-8 - Read Mode flag:
- 00 = Read pipe as byte stream.
- 01 = Read pipe as a message stream.
- 7-0 - Reserved and must be set to zero.
Return Code
rc (USHORT) - return
Return code descriptions are:
- 0 NO_ERROR
- 87 ERROR_INVALID_PARAMETER
- 230 ERROR_BAD_PIPE
- 231 ERROR_PIPE_BUSY
- 233 ERROR_PIPE_NOT_CONNECTED
Remarks
The read mode and blocking/non-blocking mode of a named pipe can be changed. The pipe mode can not be changed to non-blocking when another thread is blocked on an I/O to the same end of the pipe.
Example Code
C Binding
#define INCL_DOSNMPIPES USHORT rc = DosSetNmPHandState(Handle, PipeHandleState); HPIPE Handle; /* Pipe handle */ USHORT PipeHandleState; /* Pipe handle state */ USHORT rc; /* return code */
MASM Binding
EXTRN DosSetNmPHandState:FAR INCL_DOSNMPIPES EQU 1 PUSH WORD Handle ;Pipe handle PUSH WORD PipeHandleState ;Pipe handle state CALL DosSetNmPHandState Returns WORD