Ruby Socket编程实例

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require "socket"
def testTCPServer
    server = TCPServer.new 2000 # Server bound to port 2000
 
    loop do
        client = server.accept    # Wait for a client to connect
        client.puts "Hello !"
        client.puts "Some thing from Server"
        puts client.gets
        client.close
    end    
end
testTCPServer