Skip to content

Instantly share code, notes, and snippets.

@danghvu
Last active December 17, 2015 19:39
Show Gist options
  • Save danghvu/5662298 to your computer and use it in GitHub Desktop.
Save danghvu/5662298 to your computer and use it in GitHub Desktop.
write does not block ?
# server.rb
require 'socket'
server = TCPServer.new 4000
loop do
client = server.accept
p client.recv(10)
p "HERE"
loop
end
#client.rb
require 'socket'
s = TCPSocket.open('localhost', 4000)
p s.write("A"*1000)
p "HERE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment