gpt4 book ai didi

winapi - 命名管道和邮槽(邮箱)有什么区别?

转载 作者:行者123 更新时间:2023-12-01 09:06:11 27 4
gpt4 key购买 nike

看起来这两种IPC机制非常相似,它们之间有什么区别吗?

最佳答案

我认为 MSDN 上对每种机制的介绍都回答了这个问题:

  • Mailslots :

    A mailslot is a mechanism for one-way interprocess communications (IPC). Applications can store messages in a mailslot. The owner of the mailslot can retrieve messages that are stored there. These messages are typically sent over a network to either a specified computer or to all computers in a specified domain.

  • Named Pipes :

    A named pipe is a named, one-way or duplex pipe for communication between the pipe server and one or more pipe clients. All instances of a named pipe share the same pipe name, but each instance has its own buffers and handles, and provides a separate conduit for client/server communication


  • 所以:
  • 命名管道是面向连接的,邮槽不是。
  • 邮槽可用于广播,命名管道不能。

  • (总结:邮槽很像UDP,但命名管道更接近TCP。计算机之间邮槽的424字节限制比普通网络上的UDP数据包更有限。)

    虽然邮槽和命名管道都可以具有 ACL(限制不同客户端用户可以执行的操作),但命名管道还允许委托(delegate)客户端的身份,因此服务器可以作为该用户(或被阻止)操作(访问其他资源)。

    (已编辑以更正有关安全性的信息,并注意邮槽消息大小限制。)

    关于winapi - 命名管道和邮槽(邮箱)有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7186876/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com