qmsk/net/transport/client.py
author Tero Marttila <terom@fixme.fi>
Sat, 26 Sep 2009 16:39:20 +0300
changeset 50 da394bb715af
parent 28 020c89baaa33
child 45 bb49bf8222ed
permissions -rw-r--r--
try and keep lib.event2.event objects alive (via self-ref) while pending
"""
    Abstract Client interface
"""

class Client (object) :
    """
        A Client establishes a connection to some remote Service.
        
        This is an abstract base class that is further impemented by e.g. TCP or SSL.

        Note that a Client behaves more like a factory, such that the Client itself is not a Transport, one must instead
        call .connect(), rather like one must call Service.accept().
    """

    def __init__ (self, endpoint) :
        """
            Connect to the given remote endpoint.

                endpoint        - the remote Endpoint to connect to
        """

        raise NotImplementedError()

    def connect (self, cls=None) :
        """
            Perform the connect operation, returning a new Transport.
                
                cls         - optional transport-specific type to use for the new connection.
        """

        raise NotImplementedError()