网站首页  词典首页

请输入您要查询的函数:

 

术语 setnamedpipehandlestate
释义 SetNamedPipeHandleState
语法:
C++
BOOL WINAPI SetNamedPipeHandleState(
__in HANDLE hNamedPipe,
__in_opt LPDWORD lpMode,
__in_opt LPDWORD lpMaxCollectionCount,
__in_opt LPDWORD lpCollectDataTimeout
);
SetNamedPipeHandleState功能
设置阅读模式和指定的命名管道阻塞模式。如果指定的处理是,一个命名管道客户端,如果命名管道服务器进程在远程计算机的功能也可以用来控制本地缓冲。
参数
hNamedPipe [in]
句柄到命名管道实例。此参数可以是一个句柄管道的服务器端,因为返回的CreateNamedPipe功能,或管道的客户端,由CreateFile函数返回。句柄必须GENERIC_WRITE访问的只写或读/写管道,或者必须有命名管道GENERIC_READ和FILE_WRITE_ATTRIBUTES为只读管访问。
此参数也可以是一个处理一个匿名管道,由CreatePipe函数返回。
lpMode [中,可选]
新的管道模式。该模式是一个读结合模式标志和等待模式标志。此参数可以是NULL如果模式没有被设置。指定下列方式之一。
ModeMeaning
PIPE_READMODE_BYTE
0x00000000Data是读取以字节流管。这种模式是,如果没有读模式标志指定的默认。
PIPE_READMODE_MESSAGE
0x00000002Data是读取作为信息流管。函数失败如果此标志是一个字节型管指定。
以下等待模式可以指定一个。
ModeMeaning
PIPE_WAIT
0x00000000Blocking模式已启用。这种模式是,如果没有等待模式标志指定的默认。当阻塞模式管道句柄在了ReadFile,WriteFile,或ConnectNamedPipe函数中指定的,行动没有结束之前,是数据读取,写入的所有数据,或者客户端连接。使用这种模式意味着在等待客户端进程某些情况下无限期地执行一个动作。
PIPE_NOWAIT
0x00000001Nonblocking模式已启用。在这种模式下,ReadFile,WriteFile和ConnectNamedPipe总是立即返回。请注意,非阻塞模式的支持与Microsoft LAN Manager版本2.0的兼容性,不应用来实现异步输入和输出(I / O的命名管道)。
lpMaxCollectionCount [中,可选]
在客户端计算机上的前收集传输到服务器的最大字节数。此参数必须为NULL如果指定的管道句柄是一个命名管道服务器端或客户端和服务器进程在同一台机器中。忽略此参数,如果指定的客户端进程中CreateFile函数FILE_FLAG_WRITE_THROUGH标志时,处理已创建。此参数可以是NULL如果集合计数不被设置。
lpCollectDataTimeout [中,可选]
在最长的时间,以毫秒为单位,可以前通过远程命名管道在网络上传输的信息。此参数必须为NULL如果指定的管道句柄是一个命名管道服务器端或客户端和服务器进程在同一台计算机上。忽略此参数,如果客户端进程中指定CreateFile函数FILE_FLAG_WRITE_THROUGH标志时,处理已创建。此参数可以是NULL如果集合计数不被设置。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
实例
有关示例,请参见命名管道客户。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
ConnectNamedPipe
CreateFile
CreateNamedPipe
GetNamedPipeHandleState
管功能
管概述
ReadFile
WriteFile
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==SetNamedPipeHandleState Function
Sets the read mode and the blocking mode of the specified named pipe. If the specified handle is to the client end of a named pipe and if the named pipe server process is on a remote computer, the function can also be used to control local buffering.
Syntax
C++
BOOL WINAPI SetNamedPipeHandleState(
__in HANDLE hNamedPipe,
__in_opt LPDWORD lpMode,
__in_opt LPDWORD lpMaxCollectionCount,
__in_opt LPDWORD lpCollectDataTimeout
);
Parameters
hNamedPipe [in]
A handle to the named pipe instance. This parameter can be a handle to the server end of the pipe, as returned by the CreateNamedPipe function, or to the client end of the pipe, as returned by the CreateFile function. The handle must have GENERIC_WRITE access to the named pipe for a write-only or read/write pipe, or it must have GENERIC_READ and FILE_WRITE_ATTRIBUTES access for a read-only pipe.
This parameter can also be a handle to an anonymous pipe, as returned by the CreatePipe function.
lpMode [in, optional]
The new pipe mode. The mode is a combination of a read-mode flag and a wait-mode flag. This parameter can be NULL if the mode is not being set. Specify one of the following modes.
ModeMeaning
PIPE_READMODE_BYTE
0x00000000Data is read from the pipe as a stream of bytes. This mode is the default if no read-mode flag is specified.
PIPE_READMODE_MESSAGE
0x00000002Data is read from the pipe as a stream of messages. The function fails if this flag is specified for a byte-type pipe.

One of the following wait modes can be specified.
ModeMeaning
PIPE_WAIT
0x00000000Blocking mode is enabled. This mode is the default if no wait-mode flag is specified. When a blocking mode pipe handle is specified in the ReadFile , WriteFile , or ConnectNamedPipe function, operations are not finished until there is data to read, all data is written, or a client is connected. Use of this mode can mean waiting indefinitely in some situations for a client process to perform an action.
PIPE_NOWAIT
0x00000001Nonblocking mode is enabled. In this mode, ReadFile, WriteFile, and ConnectNamedPipe always return immediately. Note that nonblocking mode is supported for compatibility with Microsoft LAN Manager version 2.0 and should not be used to achieve asynchronous input and output (I/O) with named pipes.

lpMaxCollectionCount [in, optional]
The maximum number of bytes collected on the client computer before transmission to the server. This parameter must be NULL if the specified pipe handle is to the server end of a named pipe or if client and server processes are on the same machine. This parameter is ignored if the client process specifies the FILE_FLAG_WRITE_THROUGH flag in the CreateFile function when the handle was created. This parameter can be NULL if the collection count is not being set.
lpCollectDataTimeout [in, optional]
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 specified pipe handle is to the server end of a named pipe or if client and server processes are on the same computer. This parameter is ignored if the client process specified the FILE_FLAG_WRITE_THROUGH flag in the CreateFile function when the handle was created. This parameter can be NULL if the collection count is not being set.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Examples
For an example, see Named Pipe Client .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
ConnectNamedPipe
CreateFile
CreateNamedPipe
GetNamedPipeHandleState
Pipe Functions
Pipes Overview
ReadFile
WriteFile
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365787(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:27:35