anchor.diff:      Parent = self(),
       {ok,PortNo}=inet:port(LS),
       F1 = fun() -> Parent ! {accepted,self(),gen_tcp:accept(LS)} end,
  -    F2 = fun() -> Parent ! {connected,self(),gen_tcp:connect("localhost",PortNo,[])} end,
  +    F2 = fun() -> Parent ! {connected,self(),?CONNECT(Config, "localhost",PortNo,[])} end,
       Ns = lists:seq(1,8),
       _  = [spawn(F1) || _ <- Ns],
       ok = ?EXPECT_ACCEPTS([],1,500), % wait for tmo
  
positive.code:             SKIP
      end.
  
  do_killing_acceptor(_Config) ->
      LS = case gen_tcp:listen(0,[]) of
               {ok, LSocket} ->
                   LSocket;
               {error, eaddrnotavail = Reason} ->
  
negative.code:         {error,timeout} -> ok
      end.
  
  otp_7731_server(Config, ClientPid) ->
      {ok, LSocket} = ?LISTEN(Config, 0, [binary, {packet, raw},
                                         {active, false}]),
      {ok, {_, PortNum}} = inet:sockname(LSocket),
      ?P("Listening on ~w with port number ~p", [LSocket, PortNum]),
      ClientPid ! {self(), ready, PortNum},
  
      {ok, CSocket} = gen_tcp:accept(LSocket),
      gen_tcp:close(LSocket),
  
      ?P("Server got connection, wait for recv order..."),
  
      receive {ClientPid, recv} -> ok end,
      
      ?P("Server start receiving..."),
  
      otp_7731_recv(CSocket),
  
      ClientPid ! {self(), ok},
  
      ?P("Server finished, closing..."),
      gen_tcp:close(CSocket).
  
  
  otp_7731_recv(Socket) ->
      case gen_tcp:recv(Socket, 0, 1000) of
  	      {ok, Bin} -> 
  		  ?P("Server received ~p bytes", [size(Bin)]),
  		  otp_7731_recv(Socket);
  	      {error,timeout} ->
  		  ?P("Server got receive timeout"),
  		  ok
  	  end.
  
  