The default maximum segment size (MSS) for UDP agents is 1000 byte:
Agent/UDP set packetSize_ 1000 # max segment size;This OTcl instvar is bound to the C++ agent variable size_.
Applications can access UDP agents via the []sendmsg function in C++, or via the send or sendmsg methods in OTcl, as described in section 31.2.3.
The following is a simple example of how a UDP agent may be used in a program. In the example, the CBR traffic generator is started at time 1.0, at which time the generator begins to periodically call the UDP agent []sendmsg function.
set ns [new Simulator] set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 5Mb 2ms DropTail set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 attach-agent $udp0 $udp0 set packetSize_ 536 # set MSS to 536 bytes; set null0 [new Agent/Null] $ns attach-agent $n1 $null0 $ns connect $udp0 $null0 $ns at 1.0 "$cbr0 start"