After we have accepted a connection, it’s a good idea to explicitly set the required socket options, like this:
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
OK, so the same options need to be set for listen / accept? That seems kind of redundant--is there a reason for that? Or are these usually different options?
But listen and accept are both on the server side. Does that have anything to do w/ the client?I'll have to read up more on the TCP protocol before investigating this further, I guess.
Note also that you probably *don't* want to set {active, true} in
listen/2 in a real application, because you're probably going to hand
the socket off to another process (using
gen_tcp:controlling_process/2), and this'll cause you to miss the
occasional message during that window.
And, frankly, if you're building your own socket acceptor pool,
*don't*. Just use ranch (https://github.com/ninenines/ranch).