Sha256: d5fed2884e0489232c8fc1023c234412de5eaec318f1247ff26f9cbbafef1c3c
Contents?: true
Size: 525 Bytes
Versions: 3
Compression:
Stored size: 525 Bytes
Contents
require 'ipaddr' module OSC class BroadcastClient BROADCAST_ADDRESS = '<broadcast>' attr_reader :port def initialize(port, local_ip = nil) @port = port @so = UDPSocket.new @so.setsockopt Socket::SOL_SOCKET, Socket::SO_BROADCAST, true if local_ip @so.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_IF, IPAddr.new(local_ip).hton @so.bind(local_ip, 0) end end def send(mesg) @so.send(mesg.encode, 0, BROADCAST_ADDRESS, @port) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
osc-ruby-1.1.5 | lib/osc-ruby/broadcast_client.rb |
osc-ruby-1.1.4 | lib/osc-ruby/broadcast_client.rb |
osc-ruby-1.1.3 | lib/osc-ruby/broadcast_client.rb |