Jump to content

DosSetNmPHandState: Difference between revisions

From EDM2
Ak120 (talk | contribs)
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
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==
<PRE>
  DosSetNmPHandState (Handle, PipeHandleState)
  DosSetNmPHandState


    (Handle, PipeHandleState)
</PRE>
==Parameters==
==Parameters==
; Handle (HPIPE) - input : Handle of the named pipe returned by DosMakeNmPipe or DosOpen.  
;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.
'''Bit        Description'''
::1 = Reads/Writes return immediately if no data available.
15     Blocking flag:
::Reads normally block until at least partial data can be returned. Writes by default block until all bytes requested have been written.  
        0 = Reads /Writes block if no data available.
::Non-blocking mode (B = 1) changes this behaviour as follows:
        1 = Reads/Writes return immediately if no data available.
::*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.
        Reads normally block until at least partial data can be returned. Writes by default block until all bytes requested have been written.  
:14 - Reserved and must be set to zero.
        Non-blocking mode (B = 1) changes this behavior as follows:  
:13-11 - timer (values approximate from 0 to 14 seconds in 2 second increments)
    DosRead
:10 - Reserved and must be set to zero.
        Returns BytesRead = 0 if no data is available.  
:9-8 - Read Mode flag:
    DosWrite
::00 = Read pipe as byte stream.
        Returns BytesWritten = 0 if there is not enough buffer space available in the pipe. Otherwise, the entire data area is transferred.  
::01 = Read pipe as a message stream.
14-10     Reserved and must be set to zero.  
:7-0 - 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:
*0 NO_ERROR
*87 ERROR_INVALID_PARAMETER
*230 ERROR_BAD_PIPE
*231 ERROR_PIPE_BUSY
*233 ERROR_PIPE_NOT_CONNECTED


Return code descriptions are:
==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.


* 0          NO_ERROR
==Bindings==
* 87        ERROR_INVALID_PARAMETER
=== C ===
* 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===
<PRE>
<PRE>
#define INCL_DOSNMPIPES
#define INCL_DOSNMPIPES
Line 49: Line 40:
USHORT  rc = DosSetNmPHandState(Handle, PipeHandleState);
USHORT  rc = DosSetNmPHandState(Handle, PipeHandleState);


HPIPE           Handle;          /* Pipe handle */
HPIPE   Handle;          /* Pipe handle */
USHORT           PipeHandleState; /* Pipe handle state */
USHORT PipeHandleState; /* Pipe handle state */


USHORT           rc;              /* return code */
USHORT rc;              /* return code */
</PRE>
</PRE>
===MASM Binding===
 
===MASM===
<PRE>
<PRE>
EXTRN  DosSetNmPHandState:FAR
EXTRN  DosSetNmPHandState:FAR
Line 65: Line 57:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
==Related Functions==
*  
* [[DosRead]]


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 07:50, 26 January 2020

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 behaviour 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 - Reserved and must be set to zero.
13-11 - timer (values approximate from 0 to 14 seconds in 2 second increments)
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.

Bindings

C

#define INCL_DOSNMPIPES

USHORT  rc = DosSetNmPHandState(Handle, PipeHandleState);

HPIPE   Handle;          /* Pipe handle */
USHORT  PipeHandleState; /* Pipe handle state */

USHORT  rc;              /* return code */

MASM

EXTRN  DosSetNmPHandState:FAR
INCL_DOSNMPIPES     EQU 1

PUSH   WORD    Handle          ;Pipe handle
PUSH   WORD    PipeHandleState ;Pipe handle state
CALL   DosSetNmPHandState

Returns WORD

Related Functions