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

[ns] how to get the TCP qoodput in C++ numToDeliver?



Dear all,
  Thanks for your help.
  I have read the disscussion about the TCP goodput in the mailing list,but all are for TCL part.I want to get it in C++. So I used the numToDeliver in the tcp-sink.cc as the bytes received by the application.But the result is still wrong(more packets than expected). 
  
     numToDeliver = acker_->update(th->seqno(), numBytes);
	// update the recv window; figure out how many in-order-bytes
	// (if any) can be removed from the window and handed to the
	// application
	if (numToDeliver)
	{
		recvBytes(numToDeliver);
    }
And  recvBytes(numToDeliver)  will  call app_->recv(nbytes)
I have also read the manule about the upcall of the application.It said 
"recv(int nbytes)--Announces that nbytes of data have been received by the agent. For UDP agents, this signifies the arrival of a single packet. For TCP agents, this signifies the ``delivery'' of an amount of in-sequence data, which may be larger than that contained in a single packet (due to the possibility of network reordering). ."
 
   So how can I get the proper value of the correct number of bytes(goodput) recveived by the receiver?
Thanks 
Best Rgds,
 liu yong
 [email protected]
On Mon, 15 Oct 2001, liu yong wrote: 

>   I got a problem about the throughput measurement for the TCP traffic.The measurement result is greater than the sending rate.I know it is impossible to set the sending rate of the TCP traffic. 
> According to the suggestion I found in ns-mailing list, I attached a CBR source as the application of a TCP agent.Then I set the sending rate of CBR as 27kbps and the packetsize is 1000byte,but I found the measurement result is 122kbps.
> when I set the sending rate of CBR as 90kbps, packetsize is 250,the measurement is 127kbps.Since I need to get such measurement result in C++, so I added a counter in the
>      TcpSink::recv(packet * pkt, Handler*)
>      {
>                    pkts_arrival++;
>      }
> ,then I used a timer to caculate the throughout when the timer expires at fixed interval.
> I have used the same code in the udp::recv(packet *pkt) to get the
> throughput of UDP traffic,the result is ok(same with what I have
> set).

You're counting every packet as received, even though TCP retransmits
segments.

read
http://www.isi.edu/nsnam/archive/ns-users/webarch/2000/msg00059.html
bug report - TCPSink/*, packetSize_, headers and recvBytes()
me, Jan 2000.

L.

<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>