虽然我知道SOCK_STREAM给你一个双向字节流,如TCP或双向管道,另外两个给你一个messge / packet API,SOCK_DGRAM和SOCK_SEQPACKET的unix套接字有什么区别?
因为这些只是本地的,我不能想到有人会以一种可以重新排序数据包的方式实现SOCK_DGRAM的好理由。
http://urchin.earth.li/~twic/Sequenced_Packets_Over_Ordinary_TCP.html
注意,SOCK_SEQPACKET在行为上比SOCK_DGRAM更接近SOCK_STREAM。
引用自引用的网站:
The SOCK_SEQPACKET socket type is similar to the SOCK_STREAM type,and is also connection-oriented. The only difference between these types is that record boundaries are maintained using the SOCK_SEQPACKET type. A record can be sent using one or more output operations and received using one or more input operations,but a single operation never transfers parts of more than one record. Record boundaries are visible to the receiver via the MSG_EOR flag in the received message flags returned by the recvmsg() function. It is protocol-specific whether a maximum record size is imposed.