Runtime Congestion Window Size Estimation in TCL

  • cwnd_ variable of the TCP object returns the congestion window size

    # Defining a transport agent for sending
    set tcp [new Agent/TCP]
    # Attaching transport agent to sender node
    $ns attach-agent $sender $tcp
    # Defining a transport agent for receiving
    set sink [new Agent/TCPSink]
    # Attaching transport agent to receiver node
    $ns attach-agent $receiver $sink
    #Connecting sending and receiving transport agents
    $ns connect $tcp $sink
    #Defining Application instance
    set ftp [new Application/FTP]
    # Attaching transport agent to application agent
    $ftp attach-agent $tcp
    # data packet generation starting time
    $ns at 1.0 "$ftp start"
    # data packet generation ending time
    $ns at 6.0 "$ftp stop"
    set cwnd [$tcp set cwnd_]
    puts “Congestion Window Size = $cwnd”