Project

General

Profile

Bug #5684 » client.rb

recv -> read - vovik (Vladimir Chernis), 12/02/2011 10:17 AM

 
# encoding: utf-8

require 'socket'

def bytes(str)
str.unpack('A*').first.inspect
end

sock = TCPSocket.new('127.0.0.1', 20000)
str = sock.read

puts "bytes: #{bytes str}"
puts "encoding: #{str.encoding}"

sock.close

(3-3/4)