开发者

How reliable are unix domain sockets?

开发者 https://www.devze.com 2022-12-08 18:10 出处:网络
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.

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? Eve开发者_运维百科n 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?


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);

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号