Class: Quaff::TCPSource

Inherits:
Source
  • Object
show all
Defined in:
lib/sources.rb

Direct Known Subclasses

TCPSourceFromSocket

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Source

#remote_ip, #remote_port

Constructor Details

#initialize(ip, port) ⇒ TCPSource

Returns a new instance of TCPSource.



40
41
42
43
# File 'lib/sources.rb', line 40

def initialize ip, port
    @sock = TCPSocket.new ip, port
    @port, @ip = port, ip
end

Instance Attribute Details

#sockObject (readonly)

Returns the value of attribute sock.



38
39
40
# File 'lib/sources.rb', line 38

def sock
  @sock
end

Instance Method Details

#close(cxn) ⇒ Object



49
50
51
52
# File 'lib/sources.rb', line 49

def close cxn
    @sock.close
    cxn.sockets.delete(@sock)
end

#send_msg(_, data) ⇒ Object



45
46
47
# File 'lib/sources.rb', line 45

def send_msg _, data
    @sock.sendmsg data
end