Tcp Sink Monitor The TCPSinkMonitor is simply the merge of the code of TCPSink and LossMonitor agents. Agent was created by Luigi Iannone AGENT DETAILS The TCPSinkMonitor is configurable like the TCPSink Agent, see NS-2 Manual for futher details. The statistics kept by the agent are the following: recvbytes_ : Are the total number of bytes sent to the application layer. nlost_ : Is the number of packets lost. This is calculated from the sequence number in the header of TCP packets. If the received packet has a seqno higher than the expected it means that some packet get lost. ndup_ : Number of duplicated packets. This may arrive if some acks get lost. This is calculated from the sequence number in the TCP header of the packet. If the received packet has a seqno lower than expected it means that source has re-sent some packets due to ack loss or timeout. expected_ : Sequence number of the next expexted packet. npkts_ : Total number of received packets (including duplicate). lastPktTime_ : I s the time the last packet was received. File tcp-sink-random.tcl is a simple, easy to understand, example of agent usage. INSTALLING: 1. Copy files "tcp-sink-monitor.h" and "tcp-sink-monitor.cc" in {NSHOME}/tools/ where {NSHOME} is the directory where you have installed ns-2 2. Copy the following lines in your ns-default.tcl file: #This are the copies of TCPSink values, to inizialize #TCPSinkMonitor - GgX Agent/TCPSinkMonitor set sport_ 0 Agent/TCPSinkMonitor set dport_ 0 #XXX other kinds of sinks -> should reparent Agent/TCPSinkMonitor set packetSize_ 40 Agent/TCPSinkMonitor set maxSackBlocks_ 3 Agent/TCPSinkMonitor set ts_echo_bugfix_ false Agent/TCPSinkMonitor set generateDSacks_ false Agent/TCPSinkMonitor set qs_enabled_ false Agent/TCPSinkMonitor set RFC2581_immediate_ack_ true Agent/TCPSinkMonitor set bytes_ 0 Agent/TCPSinkMonitor set recvbytes_ 0 Agent/TCPSinkMonitor set nlost_ 0 Agent/TCPSinkMonitor set ndup_ 0 Agent/TCPSinkMonitor set expected_ -1 Agent/TCPSinkMonitor set npkts_ 0 Agent/TCPSinkMonitor set seqno_ 0 Agent/TCPSinkMonitor set lastPktTime_ 0.0 3. In Makefile.in add the following line to the list of OBJ_CC: tools/tcp-sink-monitor.o \ 4. Reconfigure and compile your NS with the following commands: ./configure make depend make You can now run the tcp-sink-random.tcl file to see how it works.