anchor.diff:    ?SET(Id, tcp_state, established).
   
   %% --- listen ---
  +
  +listen_pre(S) ->
  +  length(S#state.sockets) < ?MAX_SOCKETS.
   
   listen_args(_) ->
     [port()].
  
positive.code: 
  %% --- syn ---
  
  %% syn_pre(S) ->
  %%   in_tcp_state(S, listen).
  
  syn_pre(S) ->
    [] /= sockets_in_state(S, listen).
  
  syn_args(S) ->
    ?LET(Sock, elements(sockets_in_state(S, listen)),
         [Sock#socket.ip, Sock#socket.port, ip(), port(), uint32(), Sock#socket.id]).
  
  syn(Ip, Port, RemoteIp, RemotePort, RemoteSeq, _Id) ->
    Packet =
  
negative.code: 
  %% --- open (connect) ---
  
  open_pre(S) ->
    length(S#state.sockets) < ?MAX_SOCKETS.
  
  open_args(_) ->
    [ip(), port()].
  
  