Пример #1
0
 def __init__(self, username, password, server, port=5222, channel=None, listener=None):
     '''
     Constructor
     '''
     Connection.__init__(self, username, password, server, port, channel, listener)
     Thread.__init__(self);
     self._client = None
Пример #2
0
 def __init__(self, username, password, server, port=6667, channel=None, listener=None):
     """
     Contructor
     listener should handle a Message
     """
     Connection.__init__(self, username, password, server, port, channel, listener)
     self._socket = None
     self._receiver = None
Пример #3
0
 def __init__(self, username, password, server, port=6667, channel=None, listener=None):
     '''
     Contructor
     listener should handle a Message
     '''
     Connection.__init__(self, username, password, server, port, channel, listener)
     self._socket = None
     self._receiver = None
Пример #4
0
 def __init__(self,
              username,
              password,
              server,
              port=5222,
              channel=None,
              listener=None):
     '''
     Constructor
     '''
     Connection.__init__(self, username, password, server, port, channel,
                         listener)
     Thread.__init__(self)
     self._client = None
Пример #5
0
    def initClientSocket(self, port):
        """Connects to the server. If all is ok a connection is stored in the scenario. On error a
        dialog is shown to the user and the user may try again."""

        # get the name of the host
        host = self.host.getText()

        # did we get a hostname?
        if host == "":
            # oops, no host given, show a messagebox
            Messagebox("No server hostname given!")

            # repaint and go away
            self.wm.paint(force=1, clear=1)
            return widget.HANDLED

        try:
            # create the socket
            newSocket = socket(AF_INET, SOCK_STREAM)

            # connect to the remote system
            newSocket.connect((host, port))

            # all ok, store the new and connected socket and the extra info
            scenario.connection = Connection(socket=newSocket,
                                             host=host,
                                             port=port)

        except:
            Messagebox("Could not connect to server!")

            # repaint and go away
            self.wm.paint(force=1, clear=1)

            return widget.HANDLED

        # all is ok, we're accepting the dialog
        self.state = ACCEPTED

        return widget.DONE