[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about TCPAgent reset()



Guo, Liang,

I used to play this trick with the large-scale traffic simulations. This
is one of the better solutions to distinguish pkts for different
'conceptual' tcp connections from the same 'physical' tcp agent object.

1. Assign unique tcp agent fid_ (or flowid_?) for each 'conceptual'
connections.  2. Make TCP sinks to carry the fid_ over at the
acknowledgement packets.  3. At recv() of TCP sender, check fid_ of the
arriving packets. Discard them if the fid_'s don't match.

hope this helps,
-Polly

On Tue, 25 Jan 2000, Guo, Liang wrote:

> 
> I have a question on resetting TCPAgent and reusing it. 
> the question is: how to delete those old acknowledgement packets
> that still in flight in the network? 
> 
> This is important when we need to recycle old TCPAgents immediately
> after the connection is closed. (like in webtraf.*). Consider the
> following case: At time 1, connection 1 is set up, it transmits
> 100 packets, then close the session at time 10. Suppose the round
> trip time is 1 second. And the last ACK packet (ACK for packet 100)
> was retransmitted several times due to packet loss or extremely high
> queueing delay. Then, at time 10.1, we want to set up a new
> connection, but we want to reuse the TCPAgent that we just used,
> so the following code is called (as in webtraf.cc/tcl):
> 
> ...
>     stcp = picktcp();   // load a recycled TCPAgent from some pool
>     ssnk = picksnk();   // load a recycled TCPSink
> ...
>     $stcp reset
>     $ssnk reset
> 
>     $ns attach-agent $clnt $stcp
>     $ns attach-agent $svr $ssnk
>     $ns connect $stcp $ssnk
> ...
> 
>     $stcp advanceby XXX;  // XXX is the number of pkts to xmit, say 90
> ...
> 
> However, since the ACK packet (acking packet 100) for the previous
> connection is still in flight, so as soon as $stcp starts, it
> will get this ACK packet and end the session, but it hasn't
> sent any packet out!
> 
> I don't know how to solve this problem, increasing the pool
> size can alleviate the problem, but can not solve it. Any 
> suggestions?
> 
> Guo, Liang 
>