TG Sample Scripts
Sample Scripts
UDP
Client (udp_client.tg)
# This file specifies the following to TG:
# 1. At 15 secs open a UDP socket to send packets to the server #waiting at 192.168.10.1 and port 4322
# 2. after 5 secs setup (times specified are relative to the start time -
# 15 secs here.)
# 3. starting at time 6 secs send constant packets to the server with
# interpacket transmission time being 0.01 secs ( == 100 packets/sec)
# for 20 secs.
on 0:15 udp 192.168.10.1.4322
at 5 setup
at 6 arrival constant 0.01 length constant 576
time 20
Server (udp_server.tg)
# This script instructs TG to execute in the server or the sink mode
# in which it only receives packets and records the information in the
# binary log file. TG is initialized at time 15 secs from the start, and
# starting at 1.1 secs after initialization it waits for clients to
# send data.
#
on 0:15 udp 192.168.10.1.4322 server
at 1.1 wait
TCP
Client (tcp_client.tg)
# This file specifies the following to TG:
# 1. At 15 secs open a TCP socket to send packets to the server #waiting at
# 192.168.10.1 and port 4322
# 2. at 5 secs connect to the server (time relative to the start time )
# 3. starting at time 6 secs send exponentially varying-sized packets, #with mean size of 576 bytes, to the server with exponentially varying
# interpacket transmission times with a mean of 0.02 secs ( == 50
# packets/sec) for 20 secs.
# 4. Change phase at time 30 sec to send constant sized packets of 1024 bytes
# but exponentially varying interarrival times with mean of 0.01 secs.
# This is executed for 20 secs before TG exits
on 0:15 tcp 192.168.10.1.4322
at 5 setup
at 6 arrival exponential 0.02 length exponential 576
time 20
at 30 arrival exponential 0.01 length constant 1024
time 20
Server (tcp_server.tg)
# This script instructs TG to execute in the server or the sink mode
# in which it only receives packets and records the information in the
# binary log file. TG is initialized at time 15 secs from the start, and
# starting at 1.1 secs after initialization it waits for clients to
# send data, but only for 100 secs.
#
on 0:15 tcp 192.168.10.1.4322 server
at 1.1 wait 100
Multicast
Client (mcast_client.tg)
# The syntax is the same as that of udp_client.tg. The only difference #here is that multicast support is in the form of being able to specify #multicast addresses. The 239.192.0.1 multicast address specification #allows TG to receive multicast packets as well.
on 0:15 udp 239.192.0.1.4322
at 5 setup
at 6 arrival constant 0.01 length constant 576
time 20
Server (mcast_server.tg)
# This script instructs TG to execute in the server or the sink mode
# in which it only receives packets and records the information in the
# binary log file. TG is initialized at time 15 secs from the start, and
# starting at 1.1 secs after initialization it waits for clients to
# send data. The 239.192.0.1 multicast address specification allows TG to
# receive multicast packets as well.
on 0:15 udp 239.192.0.1.4322 server
at 1.1 wait
QoS
Client(qos_server.tg)
#
# Type of Service/QOS field depends on the OS support for setting
# the TOS field in the IP header as specified in the RFC 791.
#(e.g., # SunOS 4.4.1 does not support setting TOS field). A subset
# of the bits from the original TOS field are currently used for
# supporting Differentiated Services. See RFC 2474
#
on 0:15 udp 192.168.10.1.4322
tos 30
at 5 setup
at 6 arrival constant 0.01 length constant 576
time 5
Server (qos_server.tg)
# This script instructs TG to execute in the server or the sink mode
# in which it only receives packets and records the information in the
# binary log file. TG is initialized at time 15 secs from the start, and
# starting at 1.1 secs after initialization it waits for clients to
# send data.
#
on 0:15 udp 192.168.10.1.4322 server
at 1.1 wait