Connecting to a UNIX Socket: unix_connect('/tmp/haproxy.stats.socket') # => # Or create a temporary UNIX Socket which will automatically be closed: unix_session('/tmp/haproxy.stats.socket') do |socket| socket.puts("command here") puts socket.readline end