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"