arriving on port 5999 and <spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._spawn%29%29"class="RktStxLink"data-pltdoc="x">spawn</a></span>s a fresh process in response
to each with the help of the auxiliary <spanclass="RktSym">echoer</span> function. The
topic of conversation associated with the each new connection is
parsed (with <spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._match-conversation%29%29"class="RktStxLink"data-pltdoc="x">match-conversation</a></span>) to name the remote
passed to <spanclass="RktSym">echoer</span> to create the initial state and actions for
the corresponding process. In this case, the process is stateless,
indicated by the special constant <spanclass="RktSym">stateless</span>.</p><p>Each connection’s process watches for incoming data, using
<spanclass="RktSym">from</span> and <spanclass="RktSym">to</span> to configure a <spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._subscriber%29%29"class="RktStxLink"data-pltdoc="x">subscriber</a></span>. It
also declares its intent to produce outbound TCP data, using
<spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._publisher%29%29"class="RktStxLink"data-pltdoc="x">publisher</a></span>. When data arrives, it is echoed back to the remote
peer using the <spanclass="RktSym"><ahref="high-level-interface.html#%28def._%28%28lib._marketplace%2Fsugar-values..rkt%29._send-message%29%29"class="RktValLink"data-pltdoc="x">send-message</a></span> operation. Absence notifications
signal disconnection; when the remote peer closes the TCP connection,
the <spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._on-absence%29%29"class="RktStxLink"data-pltdoc="x">on-absence</a></span> handler issues a <spanclass="RktSym"><ahref="high-level-interface.html#%28def._%28%28lib._marketplace%2Fsugar-values..rkt%29._quit%29%29"class="RktValLink"data-pltdoc="x">quit</a></span> action, which
terminates the connection’s process.</p><h4>6.2<tt> </tt><aname="(part._chat-server-example)"></a>TCP chat server</h4><blockquoteclass="SCodeFlow"><blockquoteclass="Rfilebox"><pclass="Rfiletitle"><spanclass="Rfilename"><spanclass="stt">"examples/chat-paper.rkt"</span></span></p><blockquoteclass="Rfilecontent"><tablecellspacing="0"class="RktBlk"><tr><td><ahref="http://docs.racket-lang.org/guide/Module_Syntax.html#%28part._hash-lang%29"class="RktModLink"data-pltdoc="x"><spanclass="RktMod">#lang</span></a><spanclass="hspace"> </span><ahref="low-level-interface.html"class="RktModLink"data-pltdoc="x"><spanclass="RktSym">marketplace</span></a></td></tr><tr><td><spanclass="hspace"> </span></td></tr><tr><td><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._spawn-vm%29%29"class="RktStxLink"data-pltdoc="x">spawn-vm</a></span></td></tr><tr><td><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="high-level-interface.html#%28def._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._at-meta-level%29%29"class="RktValLink"data-pltdoc="x">at-meta-level</a></span></td></tr><tr><td><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._observe-publishers%29%29"class="RktStxLink"data-pltdoc="x">observe-publishers</a></span><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym">tcp-channel</span><spanclass="hspace"> </span><spanclass="RktSym"><ahref="low-level-interface.html#%28def._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._~3f%29%29"class="RktValLink"data-pltdoc="x">?</a></span><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym">tcp-listener</span><spanclass="hspace"> </span><spanclass="RktVal">5999</span><spanclass="RktPn">)</span><spanclass="hspace"> </span><spanclass="RktSym"><ahref="low-level-interface.html#%28def._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._~3f%29%29"class="RktValLink"data-pltdoc="x">?</a></span><spanclass="RktPn">)</span></td></tr><tr><td><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._match-conversation%29%29"class="RktStxLink"data-pltdoc="x">match-conversation</a></span><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym">tcp-channel</span><spanclass="hspace"> </span><spanclass="RktSym">them</span><spanclass="hspace"> </span><spanclass="RktSym">us</span><spanclass="hspace"> </span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29.__%29%29"class="RktStxLink"data-pltdoc="x">_</a></span><spanclass="RktPn">)</span></td></tr><tr><td><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._on-presence%29%29"class="RktStxLink"data-pltdoc="x">on-presence</a></span><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="high-level-interface.html#%28form._%28%28lib._marketplace%2Fsugar-untyped..rkt%29._spawn%29%29"class="RktStxLink"data-pltdoc="x">spawn</a></span><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym">chat-session</span><spanclass="hspace"> </span><spanclass="RktSym">them</span><spanclass="hspace"> </span><spanclass="RktSym">us</span><spanclass="RktPn">)</span><spanclass="RktPn">)</span><spanclass="RktPn">)</span><spanclass="RktPn">)</span><spanclass="RktPn">)</span><spanclass="RktPn">)</span><spanclass="RktPn">)</span></td></tr><tr><td><spanclass="hspace"> </span></td></tr><tr><td><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/ts-reference/special-forms.html#%28for