Skip to content

Instantly share code, notes, and snippets.

View fabioxgn's full-sized avatar
🏠
Working from home

Fábio Gomes fabioxgn

🏠
Working from home
  • Leme, SP - Brazil
View GitHub Profile
@fabioxgn
fabioxgn / client.rb
Created June 1, 2021 00:40
Ruby TCP example
require "socket"
socket = TCPSocket.open("localhost", 6666)
loop do
input = gets.chomp #Ask client for command
socket.puts input # Send command to server
line = socket.gets #Get server response
puts line