about summary refs log tree commit homepage
path: root/examples/random_thrash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'examples/random_thrash.rb')
-rw-r--r--examples/random_thrash.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/random_thrash.rb b/examples/random_thrash.rb
new file mode 100644
index 0000000..fe9311c
--- /dev/null
+++ b/examples/random_thrash.rb
@@ -0,0 +1,19 @@
+require 'socket'
+devrand = open("/dev/random","r")
+
+loop do
+  s = TCPSocket.new(ARGV[0],ARGV[1])
+  s.write("GET / HTTP/1.1\r\n")
+  total = 0
+  begin
+    loop do
+       r = devrand.read(10)
+       n = s.write(r)
+       total += n
+    end  
+  rescue Object
+        STDERR.puts "#$!: #{total}"
+  end
+   s.close
+   sleep 1
+end