blob: 844780a45f7074469b1deaf8f1fa7287cbeae118 [file] [log] [blame]
---
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[]
----