require 'socket' s = UDPSocket.news.bind(nil, 1234) 5.times do text, sender = s.recvfrom(16) puts textend
来源: http://www.phpxs.com/code/1006981/