More About UDP
So, we have discovery and presence working over UDP IPv4 broadcasts. Itâs not ideal, but it works for the local networks we have today. However, we canât use UDP for real work, not without additional work to make it reliable. Thereâs a joke about UDP, but sometimes youâll get it, and sometimes you wonât.
Weâll stick to TCP for all one-to-one messaging. There is one more use case for UDP after discovery, which is multicast file distribution. Iâll explain why and how, then shelve that for another day. The why is simple: what we call âsocial networksâ are just augmented culture. We create culture by sharing, and this means more and more sharing works that we make or remixâphotos, documents, contracts, tweets. The clouds of devices weâre aiming toward do more of this, not less.
Now, there are two principal patterns for sharing content. One is the pub-sub pattern, where one node sends out content to a set of other nodes, all at the same time. The second is the late joiner pattern, where a node arrives somewhat later and wants to catch up to the conversation. We can deal with the late joiner using TCP unicast, but doing TCP unicast to a group of clients at the same time has some disadvantages. First, it can be slower than multicast. Second, itâs unfair since some will get the content before others.
Before you jump off to design a UDP multicast protocol, realize that itâs not a simple calculation. When you send a multicast packet, the WiFi access point ...
Get ZeroMQ 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.