stream& datagram socket

A stream socket -- provides two-way, sequenced, reliable, and unduplicated flow of data with no record boundaries. A stream operates much like a telephone conversation. The socket type is SOCK_STREAM, which, in the Internet domain, uses Transmission Control Protocol (TCP).

A datagram socket -- supports a two-way flow of messages. A on a datagram socket may receive messages in a different order from the sequence in which the messages were sent. Record boundaries in the data are preserved. Datagram sockets operate much like passing letters back and forth in the mail. The socket type is SOCK_DGRAM, which, in the Internet domain, uses User Datagram Protocol (UDP).


a stream socket  provides two way,sequenced ,reliable,and unduplicated flow of data with no record boundaries.
passing letter back and forth in the email

原文地址:https://www.cnblogs.com/elseliving/p/7528682.html