<div dir="ltr">In Joe's <a href="https://pragprog.com/book/jaerlang2/programming-erlang">Programming Erlang 2nd E</a>, Chpt. 17, pg. 274, he says:<div><br><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">After we have accepted a connection, it’s a good idea to explicitly set the required socket options, like this:</blockquote><div><div><br></div><div><font face="monospace, monospace">{ok, Socket} = gen_tcp:accept(Listen),</font></div><div><font face="monospace, monospace">inet:setopts(Socket, [{packet,4},binary,</font><span style="font-family:monospace,monospace">{nodelay,true},{active, true}]),</span></div><div><font face="monospace, monospace">loop(Socket)</font></div></div></div></div><div><br></div><div>Until then the book's been doing:</div><div><br></div><div><font face="monospace, monospace">{ok, Listen} = gen_tcp:listen(2345, [binary, {packet, 4}, {reuseaddr, true}, {active, true}])<br></font></div><div><font face="monospace, monospace">{ok, Socket} = gen_tcp:accept(Listen),<br></font></div><div><font face="monospace, monospace">...</font></div><div><font face="monospace, monospace">loop(Socket)</font></div><div><br></div><div>Is there a reason we need to set the options after accept? Is it necessary to set options on listen <i>and</i> accept?</div><div><br></div></div>