Esempio n. 1
0
    def __init__(self, host='localhost', port=9090, unix_socket=None, socket_family=socket.AF_UNSPEC):
        """Initialize a TSocket

        @param host(str)  The host to connect to.
        @param port(int)  The (TCP) port to connect to.
        @param unix_socket(str)  The filename of a unix socket to connect to.
                                 (host and port will be ignored.)
        @param socket_family(int)  The socket family to use with this socket.
        """
        self.host = host
        self.port = port

        self._unix_socket = unix_socket
        self._socket_family = socket_family

        self._timeout = None

        self.socket = None
        self.socket_buf = SocketBuffer()
        self.handle = None