You should: 1. write the issue in the message body 2. what you needed/wanted/expected and actually what occured In message <cd8ff714.0202211552.219c1347 / posting.google.com> moonerent / hotmail.com writes: > require 'socket' > server = TCPServer.new('127.0.0.1',5190) > while (session = server.accept) > begin > thisUser = session.gets > thisUser = thisUser.scan(/<user>(.*?)<\/user>/).to_s > > session.print "<userlist>#{thisUser}</userlist>\0" > > ensure > session.close if session > #puts "sesson closed" > end > end I ran it and got results I expected. That is: # on some term: >ruby <<EOS require 'socket' server = TCPServer.new('127.0.0.1',5190) while (session = server.accept) begin thisUser = session.gets thisUser = thisUser.scan(/<user>(.*?)<\/user>/).to_s session.print "<userlist>#{thisUser}</userlist>\0" ensure session.close if session #puts "sesson closed" end end EOS # and on the other: >telnet localhost 5190 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. <user>foo</user> <userlist>foo</userlist>Connection closed by foreign host. I doubt your undisclosed client code doesn't send "\n" and so the server is waiting for "\n" on IO#gets, but it's just a my guess. -- kjana / dm4lab.to February 22, 2002 Time is illusion, life is confusion.