d67d1632a8
is causing intermittent port binding problems which manifest as an unreachable server. Inserting a pause on the client side fixes the problem. Hm.
26 lines
496 B
Ruby
26 lines
496 B
Ruby
require 'socket'
|
|
|
|
successes = 0
|
|
backoff = 0.5
|
|
loop do
|
|
begin
|
|
TCPSocket.open('127.0.0.1', 22000) do |sock|
|
|
sock.send("sally #{rand(101)} #{rand(101)}\n", 0)
|
|
sock.recv(100)
|
|
sock.close
|
|
STDOUT.write('.')
|
|
STDOUT.flush
|
|
end
|
|
successes += 1
|
|
backoff = 0.5
|
|
sleep 0.01
|
|
rescue
|
|
STDOUT.write('E')
|
|
STDOUT.flush
|
|
STDERR.write("\nmade it #{successes} times. sleeping #{backoff} secs\n")
|
|
successes = 0
|
|
sleep backoff
|
|
backoff *= 2
|
|
end
|
|
end
|