简单的ruby web service with socket

2015-06-01 0 129
简单的ruby web service with socket
require 'socket'                				# Get sockets from stdlib
server = TCPServer.open(2000)   				# Socket to listen on port 2000
loop {                          				# Servers run forever
  Thread.start(server.accept) do |client|
    client.puts(Time.now.ctime) 				# Send the time to the client
	client.puts "Closing the connection. Bye!"
    client.close                				# Disconnect from the client
  end
}

遇见资源网 ruby 简单的ruby web service with socket http://www.ox520.com/16353.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务