Book Image

ZeroMQ

By : Faruk Akgul
Book Image

ZeroMQ

By: Faruk Akgul

Overview of this book

<p>ØMQ (also spelled ZeroMQ, 0MQ, or ZMQ) is a high-performance asynchronous messaging library aimed at use in scalable distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a ØMQ system can run without a dedicated message broker. The library is designed to have a familiar socket-style API.<br /><br />"ZeroMQ" teaches you to use ZeroMQ through examples in C programming language. You will learn how to use fundamental patterns of message/queuing with a step-by-step tutorial approach and how to apply them. Then, you’ll learn how to use high level APIs and to work with multiple sockets and multithreaded programs through many examples.<br /><br />This book looks at how message/queue works in general and what kinds of problems it solves. Then, it explains how ZeroMQ works and how it differs from other message/queue libraries and how it can be used in different scenarios.<br /><br />You will also learn how to apply essential message/queue design patterns in different scenarios, and how they differ from each other. It shows you practical examples you can apply. You will also learn how to work with multiple sockets.<br /><br />You will learn the basics of ZeroMQ as well as how to use different patterns.</p>
Table of Contents (12 chapters)

Transmission Control Protocol (TCP)


TCP prevents loss of data, duplication, and damage. It ensures that the sent message isn't out of order. These characteristics make it a reliable protocol, unlike UDP.

Note

Please refer to the RFC 793 guide for more information about TCP.

TCP synchronizes using a three-way handshake. Synchronization between two nodes begins when a TCP segment is sent with the SYN (0x02) flag set.

TCP sockets are one-to-one. A source node transmits messages to the destination node.

TCP sockets are one-to-one

The three-way handshake protocol

A three-way handshake allows TCP to prevent out-of-order message delivery and duplicated transmission.

  1. Transmission begins when the SYN (0x02) flag is set in a packet and is sent to the destination.

  2. The destination receives the packet with the SYN (0x02) flag and sends an acknowledgement to the source by setting the ACK (0x10) flag in the reply. This stage is called SYN-ACK.

  3. The source receives the SYN-ACK message and sends an ACK segment, which...