Project

General

Profile

Bug #9356 ยป socket-eintr.rb

charliesome (Charlie Somerville), 01/03/2014 07:29 PM

 
1
require "socket"
2

    
3
trap "USR1" do end
4

    
5
Thread.start do
6
  loop do
7
    Process.kill :USR1, $$
8
    sleep 0.01
9
  end
10
end
11

    
12
sock = TCPSocket.new("charlie.bz", 80)
13
sock.write "GET / HTTP/1.0\r\n\r\n"
14
puts sock.read