hello

lets assume that I have a server on localhost which returns a string.
but I have no control about the server and it does not to
seem to return somethink like and EOF.  

my sample client works perfectly in Perl but has a problem
in Ruby (and I prefer Ruby, of course)

the Perl client:
================
use strict;
use IO::Socket;

my $socket = IO::Socket::INET->new('localhost:5533') or die "Error: $!\n";
print $socket "create:10027566:drizzt\n";
my $str = <$socket>;
print "$str";
close($socket);


the Ruby client:
================
require "socket"
port =  5533
host = "localhost"

t = TCPSocket.new(host, port)  
t.print("create:10027566:drizzt\n")
t.readlines.each do |line|
  puts line
end
t.close

when I start the clients I get this output:
Perl:
=====
mjdev:/home/mj/own$ ./tcp-client.pl
hello from server
mjdev:/home/mj/own$


Ruby:
=====
mjdev:/home/mj/own$ ./tcp-client.rb
../tcp-client.rb:10:in `readlines': Interrupt
        from ./tcp-client.rb:10



As you can see, I interrupted the Ruby client with Ctrl-C
because there was no output. I thought that readlines
would work as Perls $str = <$socket>.

when I write

while t.gets
  puts $_
end

I get the output from the client but the Ruby script does not
exit.

../tcp-client.rb
hello from server
../tcp-client.rb:11:in `gets': Interrupt
        from ./tcp-client.rb:11

again stopped with Ctrl-C

Maybe this is a problem on the server, but I have no control
about the server.

Any ideas how to improve the Ruby script ??

thanks in advance.

Markus