anchor.diff:      flush(),
       ok.
   
  -after_send_timeout(AutoClose, Reason) ->
  -    case Reason of
  -        timeout when AutoClose =:= false -> ok;
  -        enotconn when AutoClose =:= true -> ok
  -%%%        timeout -> ok;
  -%%%        enotconn when AutoClose -> ok;
  -%%%        closed when AutoClose -> ok
  -    end.
  -
  -get_max_diff() ->
  -    receive
  -	ok ->
  -	    get_max_diff(0)
  -    after 10000 ->
  -	    exit(timeout)
  -    end.
  -
  -get_max_diff(Max) ->
  -    T1 = millis(),
  -    receive
  -	ok ->
  -	    Diff = millis() - T1,
  -	    if
  -		Diff > Max ->
  -		    get_max_diff(Diff);
  -		true ->
  -		    get_max_diff(Max)
  -	    end;
  -	{error,timeout} ->
  -	    Diff = millis() - T1,
  -	    if
  -		Diff > Max ->
  -		    Diff;
  -		true ->
  -		    Max
  -	    end
  -    after 10000 ->
  -              exit(timeout)
  -    end.
  -	    
  +mad_sender(S) ->
  +    U = rand:uniform(1000000),
  +    case gen_tcp:send(S, integer_to_list(U)) of
  +        ok ->
  +            mad_sender(S);
  +        Err ->
  +            Err
  +    end.
  +
  +flush() ->
  +    receive
  +	_X ->
  +	    flush()
  +    after 0 ->
  +	    ok
  +    end.
  +
   setup_closed_ao() ->
       Dir = filename:dirname(code:which(?MODULE)),
       ?P("[setup] start slave node"),
  
positive.code: 
  %% Test the send_timeout socket option.
  send_timeout(Config) when is_list(Config) ->
      Dir = filename:dirname(code:which(?MODULE)),
      {ok,RNode} = test_server:start_node(?UNIQ_NODE_NAME, slave,
  					[{args,"-pa " ++ Dir}]),
  
      %% Basic
      send_timeout_basic(false, RNode),
      send_timeout_basic(true, RNode),
  
      BinData = <<1:10000>>,
  
      %% Check timeout length.
      Self = self(),
      Pid = spawn(fun() ->
                          A = setup_timeout_sink(RNode, 1000, true),
  			Send = fun() ->
  				       Res = gen_tcp:send(A, BinData),
  				       Self ! Res,
  				       Res
  			       end,
  			{error,timeout} = timeout_sink_loop(Send)
  	      end),
      Diff = get_max_diff(),
      io:format("Max time for send: ~p~n",[Diff]),
      true = (Diff > 500) and (Diff < 1500),
  
      %% Wait for the process to die.
      Mon = erlang:monitor(process, Pid),
      receive {'DOWN',Mon,process,Pid,_} -> ok end,
  
      %% Check that parallell writers do not hang forever
      send_timeout_para(false, RNode),
      send_timeout_para(true, RNode),
  
      test_server:stop_node(RNode),
  
      ok.
  
  send_timeout_basic(AutoClose, RNode) ->
  
negative.code: 			     gen_tcp:connect(Host,Port,
  					     [{active,false},{packet,2}])
  		     end),
      {ok, A} = gen_tcp:accept(L),
      gen_tcp:send(A,"Hello"),
      {ok, "Hello"} = Remote(fun() -> gen_tcp:recv(C,0) end),
      A.
  