但是如果脚本使用相同的非阻塞套接字发送几条长消息,会发生什么?
socket_write($socket,$string1,$length); socket_write($socket,$string2,$string3,$string4,$length);
这些消息是否排队(在发送方/接收方?)或者接收方是否可能因为发送“并行”而获取不同消息的一部分?
例如:接收器是否有可能获得10个字节的$string1,然后30个字节的$string2,然后是另外25个字节的$string1 ……等等……
udp The User Datagram Protocol is a connectionless,unreliable,protocol with fixed record lengths. Due to these aspects,UDP requires a minimum amount of protocol overhead.
tcp The Transmission Control Protocol is a reliable,connection based,stream oriented,full duplex protocol. TCP guarantees that all data packets will be received in the order in which they were sent. If any packet is somehow lost during communication,TCP will automatically retransmit the packet until the destination host acknowledges that packet. For reliability and performance reasons,the TCP implementation itself decides the appropriate octet boundaries of the underlying datagram communication layer. Therefore,TCP applications must allow for the possibility of partial record transmission.