Module: Rex::HostCommunicationError
- Included in:
- BindFailed, 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
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#reason ⇒ Object
Returns the value of attribute reason.
Instance Method Summary collapse
-
#addr_to_s ⇒ Object
This method returns a printable address and optional port associated with the host that triggered the exception.
- #initialize(addr = nil, port = nil, reason: nil) ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
174 175 176 |
# File 'lib/rex/exceptions.rb', line 174 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
174 175 176 |
# File 'lib/rex/exceptions.rb', line 174 def port @port end |
#reason ⇒ Object
Returns the value of attribute reason.
174 175 176 |
# File 'lib/rex/exceptions.rb', line 174 def reason @reason end |
Instance Method Details
#addr_to_s ⇒ Object
This method returns a printable address and optional port associated with the host that triggered the exception.
158 159 160 161 162 163 164 165 166 |
# File 'lib/rex/exceptions.rb', line 158 def addr_to_s if host and port host.include?(':') ? "([#{host}]:#{port})" : "(#{host}:#{port})" elsif host "(#{host})" else "" end end |
#initialize(addr = nil, port = nil, reason: nil) ⇒ Object
148 149 150 151 152 |
# File 'lib/rex/exceptions.rb', line 148 def initialize(addr = nil, port = nil, reason: nil) @host = addr @port = port @reason = reason end |
#to_s ⇒ Object
168 169 170 171 172 |
# File 'lib/rex/exceptions.rb', line 168 def to_s str = super str << " #{@reason}" if @reason str end |