From: ts Date: 2002-08-15T01:06:45+09:00 Subject: Re: Problems with Marshal >>>>> "B" == Berger, Daniel writes: B> Ok, I've narrowed it down partially to a newline issue with Marshal. Here B> are a sample client and server to demonstrate. Just start the server in one B> terminal and the client in another. Uncomment the appropriate lines to view B> the different behavior. More comments at end... use #read and #write rather than #puts #gets [...] B> while true B> Thread.start(tcpServer.accept) do |s| B> puts "Accepted connection: #{s}" B> r = s.gets B> puts "Got #{r} from client" B> s.puts(x) s.write([x.size].pack("N") + x) B> s.close B> end B> end [...] B> v = s.gets v = s.read(s.read(4).unpack("N")[0]) You can also verify that the string read has the good size Guy Decoux