Sha256: 726475037cbe7b387ecf78d47a23bf89245376b52f65f6bd9515dd3e3947f807
Contents?: true
Size: 686 Bytes
Versions: 1
Compression:
Stored size: 686 Bytes
Contents
require 'socket' module Buschtelefon # No need to inheritance from Tattler because not all its features are available here (only #feed) class RemoteTattler attr_reader :host, :port def initialize(host:, port:, outbound_socket: UDPSocket.new) @host = host @port = port @outbound_socket = outbound_socket end def feed(gossip) #puts "#{@outbound_socket.local_address.ip_port} sending #{JSON.parse(gossip.message)['number']} to #{@port}" @outbound_socket.send(gossip.message, 0, @host, @port) end def inquire @outbound_socket.send("\x05", 0, @host, @port) end def to_s "#{@host}:#{@port}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
buschtelefon-0.4.0 | lib/buschtelefon/remote_tattler.rb |