Example #1
0
    def __init__(self, address, blocking=1, timeout=15):
        """Initialize an object with an address and an optional
        blocking flag."""

        self.header = ''
        self.timeout = timeout
        ClientServerSocket.__init__(self, address, blocking=blocking)
Example #2
0
 def open(self, timeout=None, authenticate=1):
     """Overloaded to provide the global timeout."""
     if timeout is None:
         timeout = self.timeout
     ClientServerSocket.open(self,
                             timeout=timeout,
                             authenticate=authenticate)
Example #3
0
    def __init__(self, address, blocking=1, timeout=15):
        """Initialize an object with an address and an optional
        blocking flag."""

        self.header  = ''
        self.timeout = timeout
        ClientServerSocket.__init__(self, address, blocking=blocking)
Example #4
0
 def open(self, timeout=None, authenticate=1, **kwargs):
     """Clears the authentication information before opening the
     connection."""
     self.authMsgSent   = 0
     self.authenticated = 0
     if timeout is None:
         timeout = self.timeout
     ClientServerSocket.open(self, timeout=timeout,
                             authenticate=authenticate,
                             **kwargs)
Example #5
0
 def open(self, timeout=None, authenticate=1, **kwargs):
     """Clears the authentication information before opening the
     connection."""
     self.authMsgSent = 0
     self.authenticated = 0
     if timeout is None:
         timeout = self.timeout
     ClientServerSocket.open(self,
                             timeout=timeout,
                             authenticate=authenticate,
                             **kwargs)
Example #6
0
    def __init__(self, address, timeout=TimeoutInterval, keepalive=0,
                 **kwargs):
        """Initialize the object by setting an authenticated flag to
        keep track of whether or not the connection has been authenticated
        yet or not."""

        self.authenticated = 0L
        self.timeout       = timeout
        self.keepalive     = keepalive
        self.authMsgSent   = 0
        # the actual address will be decided when open is called
        ClientServerSocket.__init__(self, address, **kwargs)
Example #7
0
    def close(self, msg='quit'):
        """Closes the connection with the server by sending 'quit'
        to cleanly close the connection."""

        if msg:
            try:
                self.sendCmd('quit', readresp=0)
            # it's possible that we are already disconnected
            except Sockets.SocketError:
                pass

        ClientServerSocket.close(self)
Example #8
0
    def close(self, msg='quit'):
        """Closes the connection with the server by sending 'quit'
        to cleanly close the connection."""

        if msg:
            try:
                self.sendCmd('quit', readresp=0)
            # it's possible that we are already disconnected
            except Sockets.SocketError:
                pass

        ClientServerSocket.close(self)
Example #9
0
    def close(self, msg='quit'):
        """Close the connection with server."""

        # if this is a keepalive connection then make sure we tell the
        # server that we are done.
        if self.keepalive and msg:
            try:
                self.send({'close': msg}, timeout=self.timeout)
            # it's possible that we are already disconnected
            except Sockets.SocketError:
                pass

        ClientServerSocket.close(self)
Example #10
0
    def close(self, msg='quit'):
        """Close the connection with server."""

        # if this is a keepalive connection then make sure we tell the
        # server that we are done.
        if self.keepalive and msg:
            try:
                self.send({'close': msg}, timeout=self.timeout)
            # it's possible that we are already disconnected
            except Sockets.SocketError:
                pass

        ClientServerSocket.close(self)
Example #11
0
    def __init__(self,
                 address,
                 timeout=TimeoutInterval,
                 keepalive=0,
                 **kwargs):
        """Initialize the object by setting an authenticated flag to
        keep track of whether or not the connection has been authenticated
        yet or not."""

        self.authenticated = 0L
        self.timeout = timeout
        self.keepalive = keepalive
        self.authMsgSent = 0
        # the actual address will be decided when open is called
        ClientServerSocket.__init__(self, address, **kwargs)
Example #12
0
 def send(self, msg, timeout=0):
     """Appends the newline character to the string before sending."""
     ClientServerSocket.send(self, msg + '\n', timeout=timeout)
Example #13
0
 def send(self, msg, timeout=0):
     """Appends the newline character to the string before sending."""
     ClientServerSocket.send(self, msg + '\n', timeout=timeout)
Example #14
0
 def open(self, timeout=None, authenticate=1):
     """Overloaded to provide the global timeout."""
     if timeout is None:
         timeout = self.timeout
     ClientServerSocket.open(self, timeout=timeout,
                             authenticate=authenticate)