Class: LogStash::Inputs::Tcp::TCPInput

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/logstash/inputs/tcp.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, receiver, logger) ⇒ TCPInput

Returns a new instance of TCPInput.



42
43
44
45
46
47
# File 'lib/logstash/inputs/tcp.rb', line 42

def initialize(url, receiver, logger)
  @logger = logger
  @receiver = receiver
  @url = url;
  @buffer = BufferedTokenizer.new  # From eventmachine
end

Instance Method Details

#receive_data(data) ⇒ Object

def initialize



49
50
51
52
53
54
# File 'lib/logstash/inputs/tcp.rb', line 49

def receive_data(data)
  @buffer.extract(data).each do |line|
    port, host = Socket.unpack_sockaddr_in(self.get_peername)
    @receiver.receive(host, port, line)
  end
end