I wonder why I can’t YAML load right after YAML dump
I tried following code, but there is no “end” printing on console
could someone tell me what’s wrong with me?
thanking you
server side ruby code
require 'socket'
require 'yaml'
h = []
s = TCPServer.open('localhost',2200)
c = s.accept
loop do
YAML.dump(h,c)
YAML.load(c)
puts "end"
end
client side ruby code
require 'socket'
require 'yaml'
d = []
s = TCPSocket.open('localhost',2200)
loop do
d = YAML.load(s)
YAML.dump("client",s)
puts "end"
end
YAMLdoesn’t know in advance how many bytes to read, so it tries to read as much as possible and waits forever. There is noend_of_recordforTCP/IP.