I noticed that I press Ctrl + C, waiting for a response from the server, and for some time the last response arrives, the application terminates. But while I wait on the socket (s.gets), Ctrl + C has no effect.
, .
require 'socket'
host = '...'
port = ...
t = Thread.new do
s = TCPSocket.open(host, port)
while line = s.gets
puts line.chop
end
s.close
end
STDIN.getc
script, . .