anchor.diff:  	  [link,{priority,high}]),
       receive
   	{Sender,{port,SP}} ->
  -	    erlang:trace(self(), true,
  -			 [running,'receive',{tracer,Tracer}]),
  +	    erlang:trace(R, true,
  +			 [running_ports,'send',{tracer,Tracer}]),
   	    erlang:yield(),
   	    Sender ! {Receiver,go},
  -	    read_packets_recv(Len),
  -	    erlang:trace(self(), false, [all]),
  +	    read_packets_recv(Msgs),
  +	    erlang:trace(R, false, [all]),
   	    Tracer ! {Receiver,get_trace},
   	    receive
   		{Tracer,{trace,Trace}} ->
  -		    read_packets_verify(R, SP, Msgs, Trace)
  +		    {read_packets_verify(R, SP, Trace), Trace}
   	    end
       end.
   
  -read_packets_send(S, RP, [Msg|Msgs]) ->
  -    ok = gen_udp:send(S, localhost, RP, Msg),
  -    read_packets_send(S, RP, Msgs);
  -read_packets_send(_S, _RP, []) ->
  -    ok.
  +read_packets_send(_S, _RP, 0) ->
  +    ok;
  +read_packets_send(S, RP, Msgs) ->
  +    ok = gen_udp:send(S, localhost, RP, "UDP FLOOOOOOD"),
  +    read_packets_send(S, RP, Msgs - 1).
   
   read_packets_recv(0) ->
       ok;
  
positive.code: 	    timeout
      end.
  
  read_packets_verify(R, SP, Msg, Trace) ->    
      lists:reverse(
        lists:sort(read_packets_verify(R, SP, Msg, Trace, 0))).
  
  read_packets_verify(R, SP, Msgs, [{trace,Self,OutIn,_}|Trace], M) 
    when Self =:= self(), OutIn =:= out;
         Self =:= self(), OutIn =:= in ->
      push(M, read_packets_verify(R, SP, Msgs, Trace, 0));
  read_packets_verify(R, SP, [Msg|Msgs],
  		    [{trace,Self,'receive',{udp,R,{127,0,0,1},SP,Msg}}
  		     |Trace], M)
    when Self =:= self() ->
      read_packets_verify(R, SP, Msgs, Trace, M+1);
  read_packets_verify(_R, _SP, [], [], M) ->
      push(M, []);
  read_packets_verify(_R, _SP, Msgs, Trace, M) ->
      ct:fail({read_packets_verify,mismatch,Msgs,Trace,M}).
  
  push(0, Vs) ->
      Vs;
  
negative.code: %%
  %% Starts a slave node that on command sends a bunch of messages
  %% to our UDP port. The receiving process just receives and
  %% ignores the incoming messages.
  %% A tracing process traces the receiving port for
  %% 'send' and scheduling events. From the trace,
  %% how many messages are received per in/out scheduling,
  %% which should never be more than the read_packet parameter.
  
  %% OTP-6249 UDP option for number of packet reads.
  read_packets(Config) when is_list(Config) ->
      N1 = 5,
      N2 = 1,
      Msgs = 30000,
      {ok,R} = gen_udp:open(0, [{read_packets,N1}]),
      {ok,RP} = inet:port(R),
      {ok,Node} = start_node(gen_udp_SUITE_read_packets),
      Die = make_ref(),
      %%
      {V1, Trace1} = read_packets_test(R, RP, Msgs, Node),
      {ok,[{read_packets,N1}]} = inet:getopts(R, [read_packets]),
      %%
      ok = inet:setopts(R, [{read_packets,N2}]),
      {V2, Trace2} = read_packets_test(R, RP, Msgs, Node),
      {ok,[{read_packets,N2}]} = inet:getopts(R, [read_packets]),
      %%
      stop_node(Node),
      ct:log("N1=~p, V1=~p vs N2=~p, V2=~p",[N1,V1,N2,V2]),
  
      dump_terms(Config, "trace1.terms", Trace2),
      dump_terms(Config, "trace2.terms", Trace2),
  
      %% Because of the inherit racy-ness of the feature it is
      %% hard to test that it behaves correctly.
      %% Right now (OTP 21) a port task takes 5% of the
      %% allotted port task reductions to execute, so
      %% the max number of executions a port is allowed to
      %% do before being re-scheduled is N * 20
  
      if
          V1 > (N1 * 20) ->
              ct:fail("Got ~p msgs, max was ~p", [V1, N1]);
          V2 > (N2 * 20) ->
              ct:fail("Got ~p msgs, max was ~p", [V2, N2]);
          true ->
              ok
      end.
  
  dump_terms(Config, Name, Terms) ->
      FName = filename:join(proplists:get_value(priv_dir, Config),Name),
      file:write_file(FName, term_to_binary(Terms)),
      ct:log("Logged terms to ~s",[FName]).
  
  infinite_loop(Die) ->
      receive 
  