Package wtf :: Package opi :: Module listener :: Class InetSocket
[hide private]
[frames] | no frames]

Class InetSocket

source code

     object --+    
              |    
SocketDecorator --+
                  |
                 InetSocket

Decorator for TCP/IP(v6) sockets
Instance Methods [hide private]
 
__init__(self, socket, bindspec, host, family, bind)
Initialization
source code
int
__cmp__(self, other)
Compare (3-way) to a different object
source code
 
bind(self)
Bind the socket according to bindspec
source code
int
family(self)
Determine the socket family
source code
any
key(self)
Determine the socket key
source code
any
anykey(self)
Determine the socket ANY key
source code

Inherited from SocketDecorator: __del__, __eq__, __getattr__, __repr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from SocketDecorator (private): _famcomp

Instance Variables [hide private]
tuple _bind
bind value from getaddrinfo(3)
int _family
socket family
str _host
Hostname/IP (or None for ANY)

Inherited from SocketDecorator: bindspec, realsocket

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, socket, bindspec, host, family, bind)
(Constructor)

source code 
Initialization
Parameters:
  • socket (socket.socket) - Actual socket object
  • bindspec (str) - Bind specification from config
  • host (str) - Hostname/IP or None
  • family (int) - Socket family
  • bind (tuple) - bind value from getaddrinfo(3)
Overrides: object.__init__

__cmp__(self, other)
(Comparison operator)

source code 

Compare (3-way) to a different object

In addition to the base's __cmp__ method, we compare the host and the rest of the bind value.

Parameters:
  • other - The other object
Returns: int
Comparison result (-1, 0, 1) for self being less, equal or greater than/to other
Raises:
  • NotImplementedError - The socket family of either socket is not in the index
Overrides: SocketDecorator.__cmp__

bind(self)

source code 
Bind the socket according to bindspec
Overrides: SocketDecorator.bind

family(self)

source code 
Determine the socket family
Returns: int
The family
Overrides: SocketDecorator.family

key(self)

source code 
Determine the socket key
Returns: any
The key
Overrides: SocketDecorator.key

anykey(self)

source code 
Determine the socket ANY key
Returns: any
The key
Overrides: SocketDecorator.anykey