Class: LogStash::Inputs::Tcp::TCPInput
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- LogStash::Inputs::Tcp::TCPInput
- Defined in:
- lib/logstash/inputs/tcp.rb
Instance Method Summary collapse
-
#initialize(url, receiver, logger) ⇒ TCPInput
constructor
A new instance of TCPInput.
-
#receive_data(data) ⇒ Object
def initialize.
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 |