Last active
December 17, 2015 19:39
-
-
Save danghvu/5662298 to your computer and use it in GitHub Desktop.
write does not block ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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