module Kamerling module NetDispatcher module_function def dispatch addr, bytes case addr.prot when :TCP then TCPSocket.open(*addr) { |socket| socket << bytes } when :UDP then UDPSocket.new.send bytes, 0, *addr end end end end