Skip to content

Instantly share code, notes, and snippets.

@unclebilly
Created April 16, 2014 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unclebilly/10882630 to your computer and use it in GitHub Desktop.
Save unclebilly/10882630 to your computer and use it in GitHub Desktop.
require 'socket'
socket = TCPSocket.new('127.0.0.1', 80)
# In JRuby 1.7.10, reading 0 bytes blocks the caller.
# In MRI 1.9.3 and 2.1.1, reading 0 bytes immediately returns an empty string.
socket.read(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment