I have a server that disconnects frequently
$echo "GET hosts" | nc localhost 323
a.host.com
b.host.com
c.host.com
While reading the same thing from ruby with following code
s = TCPSocket.new(host,port)
s.puts "GET hosts\n\n\r\r"
data = ""
begin
until s.closed?
l = s.gets
puts "Host:" + l
data = data + l
end
rescue Exception => e
puts "pp" + e.message
end
prints out
Host:a.host.com
Host:b.host.com
Host:c.host.com
Host:Error reading from 3: Connection reset by peer
And the application hangs, somehow. Any heads up for this?? Weird thing is that it is not entering the exception handler.