[erlang-questions] gen_tcp:accept use within a gen_fsm process
Per Hedeland
per@REDACTED
Tue Jun 26 13:56:45 CEST 2007
igwan <igwan@REDACTED> wrote:
>
>It works well. Thanks for pointing this out.
>This blocking call stuff is unusual for me, but maybe I'm too used to
>message passing and asynchronicity :)
>I would have expected gen_tcp to send messages for incoming connections
>attempts and let the code decide if it accepts the connection or not. As
>far as I read in the doc, there's no means of refusing or selectively
>ignoring an incoming tcp connection based on eg. origin IP address. You
>must already have blindly accepted the TCP connection before you have
>access to this info. Or am I missing something again ?
The latter is (again) a property of the underlying (standard) socket API
(as long as you're using SOCK_STREAM sockets such as TCP). This doesn't
imply that 'accept' has to be implemented as a blocking operation
though, in fact if you're brave you can use prim_inet:async_accept/2 on
the socket you got from gen_tcp:listen/2.
--Per Hedeland
More information about the erlang-questions
mailing list