anchor.diff:     socket   = undefined :: #socket{}
     ,flowctl  = true      :: once | false | true | integer()  %% flow control strategy
     ,trace    = undefined :: _
  +  ,timeout  = undefined :: [_]
     ,so       = undefined :: [_]
   }).
   
  
positive.code: %%%------------------------------------------------------------------   
  
  %%
  %% socket connectivity
  tcp_connect(Uri, #state{socket = Sock, so = SOpt} = State) ->
     [$^ ||
        connect(Uri, Sock, SOpt),
        fmap(State#state{socket = _})
     ].
  
  tcp_accept(Uri, #state{socket = Sock, so = SOpt} = State) ->
     [$^ ||
  
negative.code: 
  %%
  %% socket timeout
  time_to_live(#state{timeout = SOpt} = State) ->
     [$? || 
        opts:val(ttl, undefined, SOpt), 
        tempus:timer(_, ttl)
     ],
     {ok, State}.
  
  time_to_hibernate(#state{timeout = SOpt} = State) ->
     [$? || 
        opts:val(tth, undefined, SOpt), 
        tempus:timer(_, tth)
     ],
     {ok, State}.
  
  time_to_packet(N, #state{socket = Sock, timeout = SOpt} = State) ->
     case knet_gen_tcp:getstat(Sock, Packet) of
        X when X > N orelse N =:= 0 ->
           [$? ||
              opts:val(ttp, undefined, SOpt),
              tempus:timer(_, {ttp, X})
           ],
           {ok, State};
        _ ->
           {error, timeout}
     end.
  
  
  
  
  %%
  %% socket up/down link i/o
  stream_flow_ctrl(#state{flowctl = true, socket = Sock} = State) ->
     [$^ ||
        setopts(Sock, [{active, ?CONFIG_IO_CREDIT}]),
        fmap(State)
     ];
  stream_flow_ctrl(#state{flowctl = once, socket = Sock} = State) ->
     [$^ ||
        setopts(Sock, [{active, ?CONFIG_IO_CREDIT}]),
        fmap(State)
     ];
  stream_flow_ctrl(#state{flowctl = _N, socket = Sock} = State) ->
     [$^ ||
        setopts(Sock, [{active, ?CONFIG_IO_CREDIT}]),
        fmap(State)
     ].
  
  %%
  %%
  pipe_to_side_a(Pipe, Event, #state{socket = Sock} = State) ->
     [$^ ||
        knet_gen_tcp:peername(Sock),
        fmap(pipe:a(Pipe, {tcp, self(), {Event, _}})),
        fmap(State)
     ].
  
  %%
  %%
  pipe_to_side_b(Pipe, Event, #state{socket = Sock} = State) ->
     [$^ ||
        knet_gen_tcp:peername(Sock),
        fmap(pipe:b(Pipe, {tcp, self(), {Event, _}})),
        fmap(State)
     ].
  
  
  
  
  %%
  tcp_uplink_established(Pipe, #state{socket = Sock} = State) ->
  