Method: Rex::Socket::TcpServer#accept

Defined in:
lib/rex/socket/tcp_server.rb

#accept(opts = {}) ⇒ Object

Accepts a child connection.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/rex/socket/tcp_server.rb', line 45

def accept(opts = {})
  t = super()

  # jRuby compatibility
  if t.respond_to?('[]')
    t = t[0]
  end

  if (t)
    t.extend(Rex::Socket::Tcp)
    t.context = self.context

    pn = t.getpeername

    t.peerhost = pn[1]
    t.peerport = pn[2]
  end

  t
end