Module: Rex::HostCommunicationError

Included in:
AddressInUse, ConnectionError
Defined in:
lib/rex/exceptions.rb

Overview

This exception is raised when there is some kind of error related to communication with a host.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host


167
168
169
# File 'lib/rex/exceptions.rb', line 167

def host
  @host
end

#portObject

Returns the value of attribute port


167
168
169
# File 'lib/rex/exceptions.rb', line 167

def port
  @port
end

Instance Method Details

#addr_to_sObject

This method returns a printable address and optional port associated with the host that triggered the exception.


157
158
159
160
161
162
163
164
165
# File 'lib/rex/exceptions.rb', line 157

def addr_to_s
  if host and port
    "(#{host}:#{port})"
  elsif host
    "(#{host})"
  else
    ""
  end
end

#initialize(addr = nil, port = nil) ⇒ Object


148
149
150
151
# File 'lib/rex/exceptions.rb', line 148

def initialize(addr = nil, port = nil)
  self.host = addr
  self.port = port
end