TCPSocket

class TCPSocket

Parent:
IPSocket

TCPSocket represents a TCP/IP client socket.

A simple client may look like:

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

Public Class Methods

gethostbyname(hostname) → [official_hostname, alias_hostnames, address_family, *address_list] 登录查看完整内容