Class: Wires::Cluster::UDP::TX
- Defined in:
- lib/wires/cluster/udp.rb
Instance Attribute Summary
Attributes inherited from Xceiver
#group, #local_ip, #local_port, #port, #socket
Instance Method Summary collapse
Methods inherited from Xceiver
#close, #initialize, new, #open
Constructor Details
This class inherits a constructor from Wires::Cluster::UDP::Xceiver
Instance Method Details
#configure ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/wires/cluster/udp.rb', line 48 def configure # Set up for multicasting @socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_TTL, [1].pack('i') # Bind to any available port @socket.bind "0.0.0.0", (@bind_port or 0) end |
#puts(m) ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/wires/cluster/udp.rb', line 57 def puts(m) max = UDP.max_length if m.size > max self.puts m[0...max] self.puts m[max...m.size] else @socket.send(m, 0, @group, @port) m end end |