For the More Curious: Datagrams

What we’ve been talking about in this chapter are stream sockets. They are a connection-oriented, reliable form of network communication. Berkeley sockets also support datagram sockets. These are a message-oriented, unreliable form of network communication. They are unreliable in the sense that datagrams may be lost in transit and that the receiver might not get the datagrams in the same order in which they were sent. The data in the payload is checksummed, so it will be correct. Stream sockets use the TCP protocol, and datagram sockets use the UDP protocol.

Figure 14.3  TCP versus UDP

TCP versus UDP

To create a datagram socket ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.