---
layout: default
---
:source-highlighter: coderay
:icons: font

include::banner.adoc[]

== Pair (Two Way Radio)

image::../pair.png[Two Way Radio]

The pair pattern is used when there a one-to-one peer relationship.
Only one peer may be connected to another peer at a time, but both
may speak freely.

.pair.c
[source,c]
----
include::src/pair.c[]
----
<1> Blithely assumes message is ASCIIZ string. Real code should check it.

.Compilation
[source,bash]
----
gcc pair.c -lnng -o pair
----

.Execution
[source,bash]
----
include::src/pair.sh[]
----

.Output
----
include::src/pair.out[]
----
