Hi -<br><br>I'm going through the exercises in Programming Erlang, and I run into a puzzling error with the parallel_server example.  Below is my almost verbatim copy from the book.<br><br><div style="margin-left: 40px;">
<span style="font-family: courier new,monospace;">para_server() -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    {ok, Listen} = gen_tcp:listen(2345, [binary, {packet, 4},
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                     {reuseaddr, true},</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
                     {active, true}]),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    spawn(fun () -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
          par_connect(Listen) end).</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">par_connect(Listen) -></span><br>
<span style="font-family: courier new,monospace;">    {ok, Socket} = gen_tcp:accept(Listen),</span><br><span style="font-family: courier new,monospace;">    spawn(fun () -></span><br><span style="font-family: courier new,monospace;">
          par_connect(Listen) end),</span><br><span style="font-family: courier new,monospace;">    loop(Socket).</span><br><span style="font-family: courier new,monospace;"></span></div><br>When I try to run the code, I ended up with a badmatch error. 
<br><br><div style="margin-left: 40px;">(emacs@localhost)12> P5 = spawn(nano_server, para_server, []).<br><0.67.0><br><br>=ERROR REPORT==== 15-Oct-2007::18:04:30 ===<br>Error in process <0.68.0> on node '
emacs@localhost' with exit value: {{badmatch,{error,closed}},[{nano_server,par_connect,1}]}<br></div><br>So <span style="font-family: courier new,monospace;">gen_tcp:accept(Listen)</span> returns <span style="font-family: courier new,monospace;">
{error, closed}</span> instead of <span style="font-family: courier new,monospace;">{ok, Socket}</span>, but I'm not sure why, as the <span style="font-family: courier new,monospace;">gen_tcp:listen</span> line appears to run correctly (and I've also verified that the seq_server version works).  I must be missing something extremely obvious here. 
<br><br>Any thoughts are appreciated, thanks.<br>yc<br><br>