summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.samples/tcptest.tcl
diff options
context:
space:
mode:
authortpnguyen <tpnguyen>2006-11-02 19:03:03 +0000
committertpnguyen <tpnguyen>2006-11-02 19:03:03 +0000
commitb8dc427ea7b28374756092fe6614919f568f7052 (patch)
treeefd976a1e97e5c1181408be255c7bc805a0d4f52 /testsuite/systemtap.samples/tcptest.tcl
parent1b23e9c2eff35c8385ca4a70324dcfd4cbba4e69 (diff)
downloadsystemtap-steved-b8dc427ea7b28374756092fe6614919f568f7052.tar.gz
systemtap-steved-b8dc427ea7b28374756092fe6614919f568f7052.tar.xz
systemtap-steved-b8dc427ea7b28374756092fe6614919f568f7052.zip
2006-11-02 Thang Nguyen <thang.p.nguyen@intel.com>
* systemtap.samples/tcptest.exp: Put TCP load gen into a a seperate script. * systemtap.samples/tcptest.tcl: new script for TCP load gen.
Diffstat (limited to 'testsuite/systemtap.samples/tcptest.tcl')
-rwxr-xr-xtestsuite/systemtap.samples/tcptest.tcl30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/systemtap.samples/tcptest.tcl b/testsuite/systemtap.samples/tcptest.tcl
new file mode 100755
index 00000000..18d92593
--- /dev/null
+++ b/testsuite/systemtap.samples/tcptest.tcl
@@ -0,0 +1,30 @@
+#!/usr/bin/tclsh
+
+set host localhost
+set port 11900
+
+proc receiver {sock addr port} {
+ fconfigure $sock -encoding binary -buffersize 16
+ while {[read $sock 16] != {}} { }
+ exit
+}
+
+proc sender { } {
+ set tst_str "1234567890123456"
+ after 2000
+ while {[catch {set sock [socket $::host $::port]}]} {}
+ fconfigure $sock -encoding binary -buffersize 16
+ for {set i 6400} {$i > 0} {incr i -1} {
+ puts -nonewline $sock $tst_str;
+ }
+ return 0
+}
+
+if {[llength $argv] == 0} {
+ socket -server receiver $port
+ after 30000 set thirty_secs timeout
+ vwait thirty_secs
+} else {
+ exec $argv0 &
+ sender
+}