Class: Fluent::PluginHelper::Server::UDPCallbackSocket

Inherits:
CallbackSocket
  • Object
show all
Defined in:
lib/fluent/plugin_helper/server.rb

Constant Summary collapse

ENABLED_EVENTS =
[]

Instance Method Summary collapse

Methods inherited from CallbackSocket

#close, #close_after_write_complete, #data, #on, #send

Constructor Details

#initialize(sock, peeraddr, **kwargs) ⇒ UDPCallbackSocket

Returns a new instance of UDPCallbackSocket.



495
496
497
498
# File 'lib/fluent/plugin_helper/server.rb', line 495

def initialize(sock, peeraddr, **kwargs)
  super("udp", sock, ENABLED_EVENTS, **kwargs)
  @peeraddr = peeraddr
end

Instance Method Details

#remote_addrObject



500
501
502
# File 'lib/fluent/plugin_helper/server.rb', line 500

def remote_addr
  @peeraddr[3]
end

#remote_hostObject



504
505
506
# File 'lib/fluent/plugin_helper/server.rb', line 504

def remote_host
  @peeraddr[2]
end

#remote_portObject



508
509
510
# File 'lib/fluent/plugin_helper/server.rb', line 508

def remote_port
  @peeraddr[1]
end

#write(data) ⇒ Object



512
513
514
# File 'lib/fluent/plugin_helper/server.rb', line 512

def write(data)
  @sock.send(data, 0, @peeraddr[3], @peeraddr[1])
end