æè¿ ParallelServer ã¨ããã©ã¤ãã©ãªãä½ã£ãã®ã§ããããã®æä¸ã«å¥å¦ãªç¶æ
ã«ãªã£ã¦ã TCP ãã¼ããè¦ã¤ããã®ã§ãã¡ã¢ã£ã¦ããã¾ãã Ruby ã§ã¯ TCP ãµã¼ãã¼ã¯æ¬¡ã®ãããªæãã§ä½ããã¨ãã§ãã¾ãããæ軽ã§ããã require 'socket' Socket.tcp_server_loop(12345) do |socket, client_addr| socket.puts "Your IP address: #{client_addr.ip_address}" name = socket.gets socket.puts "Hello, #{name}" socket.close end ãã㯠12345 ãã¼ãã§ã¯ã©ã¤ã¢ã³ãããã®æ¥ç¶ãå¾
ã¡ãæ¥ç¶ããããã¯ã©ã¤ã¢ã³ãã®IPã¢ãã¬ã¹ã¨ã¯ã©ã¤ã¢ã³ãããã®å
¥åãã¯ã©ã¤ã¢ã³ãã«éä¿¡ãã¦åæããã ãã®ç°¡åãªããã°ã©ã
{{#tags}}- {{label}}
{{/tags}}