Skip to content

Instantly share code, notes, and snippets.

@rdp
Forked from anonymous/close_socket.rb
Last active December 31, 2015 23:19
Show Gist options
  • Save rdp/8058776 to your computer and use it in GitHub Desktop.
Save rdp/8058776 to your computer and use it in GitHub Desktop.
require 'socket'
s = UDPSocket.new
s.bind(nil, 1234)
Thread.new { sleep 5; puts 'closing'; s.close; puts 'closed'}
puts 'if this exits with closed message, it works'
puts s.recvfrom(16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment