Class: OSC::BroadcastClient
- Inherits:
-
Object
- Object
- OSC::BroadcastClient
- Defined in:
- lib/osc-ruby/broadcast_client.rb
Constant Summary collapse
- BROADCAST_ADDRESS =
'<broadcast>'
Instance Attribute Summary collapse
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(port) ⇒ BroadcastClient
constructor
A new instance of BroadcastClient.
- #send(mesg) ⇒ Object
Constructor Details
#initialize(port) ⇒ BroadcastClient
Returns a new instance of BroadcastClient.
8 9 10 11 12 |
# File 'lib/osc-ruby/broadcast_client.rb', line 8 def initialize(port) @port = port @so = UDPSocket.new @so.setsockopt Socket::SOL_SOCKET, Socket::SO_BROADCAST, true end |
Instance Attribute Details
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/osc-ruby/broadcast_client.rb', line 6 def port @port end |
Instance Method Details
#send(mesg) ⇒ Object
14 15 16 |
# File 'lib/osc-ruby/broadcast_client.rb', line 14 def send(mesg) @so.send(mesg.encode, 0, BROADCAST_ADDRESS, @port) end |