Win32命名管道和消息大小限制-旧的64K限制仍然适用吗? [英] Win32 named pipes and message size limits - is the old 64K limit still applicable?

查看:337
本文介绍了Win32命名管道和消息大小限制-旧的64K限制仍然适用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Win32以前对消息模式管道的消息大小限制为64K,这可从知识库文章 Q119218 PRB:命名为Pipe Write()限于64K . 适用于"部分仅列出了"Microsoft Win32应用程序编程接口",并且该文章相当老.没有迹象表明它是否还适用于合理的最新版本,例如Windows7.是否有关于该问题的可靠的最新信息?

Win32 used to have a message size limit of 64K for message-mode pipes, as witnessed by the remnants of KB article Q119218 PRB: Named Pipe Write() Limited to 64K. The "applies to" section lists only "Microsoft Win32 Application Programming Interface" and the article is rather old; there is no indication whether it also applies to reasonably current versions like Windows 7. Is there any reliable, current information on the issue?

当前的联机文档仅包含未指定限制的模糊提示,例如

The current online documentation contains only nebulous hints at unspecified limits, like this beautiful wording in the documentation for the CreateNamedPipe() function:

输入和输出缓冲区的大小是建议性的.为命名管道的每个末端保留的实际缓冲区大小是系统默认值,系统最小值或最大值或指定的大小(向上舍入到下一个分配边界).

The input and output buffer sizes are advisory. The actual buffer size reserved for each end of the named pipe is either the system default, the system minimum or maximum, or the specified size rounded up to the next allocation boundary.

没有迹象表明系统最大值"可能是什么,或者如何查询其值.

There is no indication what the 'system maximum' might be, or how one would query its value.

文档 TransactNamedPipe():

命名管道事务的最大保证大小为64 KB.在某些有限的情况下,取决于参与交易的OS版本和动态网络状况,可能会进行超过64 KB的交易.但是,不能保证超过64 KB的事务将成功.

The maximum guaranteed size of a named pipe transaction is 64 kilobytes. In some limited cases, transactions beyond 64 kilobytes are possible, depending on OS versions participating in the transaction and dynamic network conditions. However, there is no guarantee that transactions above 64 kilobytes will succeed.

但是,从TransactNamedPipe()的意义上讲,该限制很可能仅适用于命名管道事务";也就是说,先写后读,都包装在单个系统调用和/或网络事务中.该限制可能与SMB有关,因此不适用于本地管道.有任何硬信息吗?

However, it might well be that the limit applies only to named pipe 'transactions' in the sense of TransactNamedPipe(); that is, a write followed by a read, all wrapped in a single system call and/or network transaction. The limit might be related to SMB and hence not applicable to local pipes. Is there any hard info on this?

消息模式管道非常适合当前的项目,在该项目中,服务器进程收到请求数据包并传递单个响应数据包,而调度程序是Apache中托管的简单多线程存根(类似于 mod_fcgid ).字节模式管道将需要一些额外的框架,这使消息模式管道看起来更简单,因此更可取.但是,不可能将请求和响应的大小限制为64K.因此是这个问题.

Message-mode pipes would be a nice fit for a current project where server processes get fed a request packet and deliver a single response packet, with the dispatcher being a simple multi-threaded stub hosted in Apache (similar to mod_fcgid). Byte-mode pipes would require a bit of additional framing, which makes message-mode pipes seem simpler and thus preferable. However, it is not possible to limit request and response sizes to 64K; hence this question.

推荐答案

不,不再有这种限制.

WriteFile的文档说:

The documentation for WriteFile says:

Windows Server 2003和Windows XP:跨网络的管道写入操作每次写入的大小受到限制.金额因平台而异.对于x86平台,它是63.97 MB.对于x64平台,它为31.97 MB.对于Itanium,则为63.95 MB.

Windows Server 2003 and Windows XP: Pipe write operations across a network are limited in size per write. The amount varies per platform. For x86 platforms it's 63.97 MB. For x64 platforms it's 31.97 MB. For Itanium it's 63.95 MB.

由此我们可以得出结论,该限制不适用于当前版本的Windows,并且可能仅在处理网络管道时才适用于XP.

From this we can conclude that the limitation does not apply to current versions of Windows, and probably only applied to XP when dealing with a network pipe.

我们还可以观察到,如果Q119218适用于当前版本的Windows,则不会被存档.

We can also observe that if Q119218 was applicable to current versions of Windows, it would not have been archived.

通过实验,我可以确认在Windows 7 SP1 x64上,本地消息模式管道可以很好地处理超过1 GB的消息. (我开始在1650MB左右的位置收到系统资源不足"消息.)

Experimentally, I can confirm that on Windows 7 SP1 x64 a local message-mode pipe can handle messages well over a gigabyte in size. (I started getting "insufficient system resources" messages somewhere around the 1650MB mark.)

这篇关于Win32命名管道和消息大小限制-旧的64K限制仍然适用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆