qubx :: remote_ctl :: RemoteCommandServer :: Class RemoteCommandServer
[hide private]
[frames] | no frames]

Class RemoteCommandServer

source code

    object --+    
             |    
sock.TCPServer --+
                 |
                RemoteCommandServer

Listens on the first available port in port..(port+seek_ports). Writes the actual port number to a text file at sockid_path, if provided. Wraps clients with RemoteController, given via callback on_connect

Instance Methods [hide private]
 
__init__(self, on_connect=<__builtin__.function object>, host='', port=25254, seek_ports=10, sockid_path=None, blocking=False, run_on_thread=<__builtin__.function object>, main_globals=None)
Raises socket.error if no ports available.
source code
 
__connected(self, client, addr) source code
 
stop(self)
Stops the listening thread and closes the socket.
source code

Inherited from sock.TCPServer: __del__, listenThread

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

Instance Variables [hide private]
  process_one
TODO: default host='' is not compatible with ipv6

Inherited from sock.TCPServer: host, port

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, on_connect=<__builtin__.function object>, host='', port=25254, seek_ports=10, sockid_path=None, blocking=False, run_on_thread=<__builtin__.function object>, main_globals=None)
(Constructor)

source code 

Raises socket.error if no ports available.

Parameters:
  • host
  • port - base TCP port number
  • session_f - function(socket.socket) called on each new connection
  • seek_ports - attempts to bind ports (port, port+1, port+2, ..., port+seek_ports) until a port is free
Overrides: object.__init__

stop(self)

source code 

Stops the listening thread and closes the socket.

Overrides: sock.TCPServer.stop