I've needed a server and client Ruby programs and found the following from a Google seach:

Server.rb
require 'socket' # Get sockets from stdlib

server = TCPServer.open(2000) # Socket to listen on port 2000
loop { # Servers run forever
client = server.accept # Wait for a client to connect
client.puts(Time.now.ctime) # Send the time to the client
client.puts "Closing the connection. Bye!"
client.close # Disconnect from the client
}


Client.rb
require 'socket' # Sockets are in standard library

hostname = 'localhost'
port = 2000

s = TCPSocket.open(hostname, port)

while line = s.gets # Read lines from the socket
puts line.chop # And print with platform line terminator
end
s.close # Close the socket when done


What I need to know is how can I execute a ruby script from the client to the server?

I'm trying to write a test harness using Ruby and so far I've written a bunch of test cases I can execute on the locale PC. But now I need to be able to execute these test cases remotely and have the results sent back to the "server".

Can any kind soul lend me a helping hand.

Thank you