From: David -- Date: 2007-08-13T12:33:53+09:00 Subject: TCPSocket Flushing I have two programs, a server and a client. I want to send two messages to the client when the client connects to the server, with a delay in between. However, both messages seem to arrive at the client at the same time. Here are the programs: ## simpleserver.rb ## run this first require "socket" server = TCPServer.new(2000) while connection = server.accept connection.write "one\n" connection.flush sleep 1 connection.write "two\n" connection.close end ## client.rb ## run this second require "socket" sock = TCPSocket.open("localhost", 2000) while not sock.eof? print sock.read end -- Posted via http://www.ruby-forum.com/.