Class: Teien::RemoteInfo
- Inherits:
-
Object
- Object
- Teien::RemoteInfo
- Defined in:
- lib/teien/core/remote_info.rb
Constant Summary collapse
- @@total_cnt =
0
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(con) ⇒ RemoteInfo
constructor
A new instance of RemoteInfo.
Constructor Details
#initialize(con) ⇒ RemoteInfo
Returns a new instance of RemoteInfo.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/teien/core/remote_info.rb', line 10 def initialize(con) @ip = nil @port = 0 if con @port, @ip = Socket.unpack_sockaddr_in(con.get_peername) if con.get_peername else @port = 0 @ip = "dummy ip" end @connection = con @id = @@total_cnt @@total_cnt += 1 end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
8 9 10 |
# File 'lib/teien/core/remote_info.rb', line 8 def connection @connection end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/teien/core/remote_info.rb', line 5 def id @id end |
#ip ⇒ Object
Returns the value of attribute ip.
6 7 8 |
# File 'lib/teien/core/remote_info.rb', line 6 def ip @ip end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/teien/core/remote_info.rb', line 7 def port @port end |