Beispiel #1
0
    def _startServer(self):
        port = int(settings.value('network/port', -1))
        if port == -1:
            port = 5000
            settings.setValue('network/port', port)

        s = socket(AF_INET, SOCK_STREAM)
        while True:
            try:
                s.bind(('', port))
                break
            except:
                port = port + 1
        s.close()
        while not self.listen(QHostAddress.Any, port):
            port = port + 1
        print 'Node server listen on port %d.' % port
Beispiel #2
0
    def _startServer(self):
        port = int(settings.value('network/port', -1))
        if port == -1:
            port = 5000
            settings.setValue('network/port', port)

        s = socket(AF_INET, SOCK_STREAM)
        while True:
            try:
                s.bind(('', port))
                break
            except:
                port = port + 1
        s.close()
        while not self.listen(QHostAddress.Any, port):
            port = port + 1
        print 'Node server listen on port %d.' % port
 def _onPlayerNameChanged(self):
         settings.setValue('player/name', self.playerName.text())