class TCPSocket

TCPSocket 代表一个 TCP/IP 客户端套接字。

一个简单的客户端可能如下所示

require 'socket'

s = TCPSocket.new 'localhost', 2000

while line = s.gets # Read lines from socket
  puts line         # and print them
end

s.close             # close socket when done