Is Gen_tcp: accept / 1 safe?

I am implementing a server that accepts many concurrent connections.

I used this structure:

loop(Sock) ->
  case gen_tcp:accept(Sock) of
      {ok, CSock} ->    
          fork_handling_process(CSock);
      {error, Reason} ->
          do_something_else();
  end,
  loop(Sock).

I am wondering if someone sends me a SYN but never sends me a SYN ACK in response to my server ACK, will my server be blocked forever by this client since I call gen_tcp: accept without timeout?

By the way, I think this situation is difficult to imitate, so please let me know if you have any ways to try.

thanks in advance.

+5
source share
2 answers

When you listen / accept it a little differently, as you describe:

: SYN, SYN/ACK (erlang not incled), ACK gen_tcp: accept .

- SYN ( SYN-flood, ), , erlang , .

SYN, .

+4

. . - , , , .

0

All Articles