Ruby

56fc8125 anonymous 2026-01-18 22:03
require "socket"

 def send_file(host, port, name)
   puts "#{name} send to ..."
 .....
 end

 def receive_file(port)
   s0 = TCPServer.open(port)
 .....
 end

で,ファイルの送受信ソケットが簡潔に書けて
チョッと工夫すれば実用的に使えることがいいね
以前は,NFS等でファイルのやり取りをしていた.
最近は,Rubyのソケット通信が便利杉

ポール・グレアム曰く「簡潔さは力なり」

Top of this page. | <<last

limit: 1536KB

(Ruby/3/0.0MB)

Powered by shinGETsu.