next up previous contents index
Next: 31.4 Simulated applications: Telnet Up: 31.3 The class TrafficGenerator Previous: 31.3.0.0.4 Traffic Trace

31.3.1 An example

The following code illustrates the basic steps to configure an Exponential traffic source over a UDP agent, for traffic flowing from node s1 to node k1:

        set src [new Agent/UDP]
        set sink [new Agent/UDP]
        \$ns\_ attach-agent \$node\_(s1) \$src
        \$ns\_ attach-agent \$node\_(k1) \$sink
        \$ns\_ connect \$src \$sink
	
        set e [new Application/Traffic/Exponential]
        \$e attach-agent \$src
        \$e set packetSize\_ 210
        \$e set burst\_time\_ 500ms
        \$e set idle\_time\_ 500ms
        \$e set rate\_ 100k

        \$ns\_ at 0.0 "\$e start"




2000-08-24