unix 域套接字的可靠性如何?

发布于 2024-08-07 23:02:04 字数 149 浏览 3 评论 0原文

我正在尝试找出一种与域套接字一起使用的协议,但无法找到有关如何盲目信任域套接字的信息。

数据会丢失吗?消息的接收顺序是否始终与发送顺序相同?即使使用数据报套接字?

传输是原子的吗?读取套接字时,我是否可以相信一次读取即可获取整个消息,还是必须自己检查?

I'm trying to figure out a protocol to use with domain sockets and can't find information on how blindly the domain sockets can be trusted.

Can data be lost? Are messages always received in the same order as sent? Even when using datagram sockets?

Are transfers atomic? When reading the socket, can I trust that I get the whole message on one read or do I have to check it myself?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

硪扪都還晓 2024-08-14 23:02:04

来自“man AF_UNIX”:

有效类型为: SOCK_STREAM,用于面向流的套接字和
SOCK_DGRAM,用于保存消息的面向数据报的套接字
边界(与大多数 Unix 实现一样,Unix 域数据报套接字
始终可靠并且不会重新排序数据报
);

From 'man AF_UNIX':

Valid types are: SOCK_STREAM, for a stream-oriented socket and
SOCK_DGRAM, for a datagram-oriented socket that preserves message
boundaries (as on most Unix implementations, Unix domain datagram sockets
are always reliable and don’t reorder datagrams
);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文