End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class · Ruby 3.1
TCPSocket
< IPSocket
2 class methods
TCPSocket represents a TCP/IP client socket.
A simple client may look like:
Example
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