def __init__(self, client, connectivity): QObject.__init__(self) self._state = GameSessionState.OFF # Subscribe to messages targeted at 'game' from the server client.subscribe_to('game', self) # Connectivity helper self.connectivity = connectivity self.connectivity.ready.connect(self.ready.emit) self.connectivity.peer_bound.connect(self._peer_bound) # Keep a parent pointer so we can use it to send # relay messages about the game state self._client = client # type: Client self.me = client.me self.game_port = client.gamePort self.player = client.me # Use the normal lobby by default self.init_mode = 0 self._joins, self._connects = [], [] # 'GPGNet' TCP listener self._game_listener = QTcpServer(self) self._game_listener.newConnection.connect(self._new_game_connection) self._game_listener.listen(QHostAddress.LocalHost) # We only allow one game connection at a time self._game_connection = None self._process = game_process_instance # type: GameProcess self._process.started.connect(self._launched) self._process.finished.connect(self._exited)
def __init__(self, parent=None): super(HTTPProxy, self).__init__(parent) self.proxy_server = QTcpServer(self) self.proxy_server.listen(QHostAddress.Any, 8000) self.proxy_server.newConnection.connect(self.manage_request) if self.debug: self.log.write('Proxy server running on 0.0.0.0 port %s\n\n' % self.port())
def __init__(self): QObject.__init__(self) # logging instance self.log = logging.getLogger('GDAIS.ControlServer') # TCP server to listen for control commands self.tcp_server = QTcpServer() # regexp to check if command is 'set_log_level' self.valid_loglevel = re.compile(r"^set_log_level (\d?0)$")
def __init__(self, port): QObject.__init__(self) # logging instance self.log = logging.getLogger('SMIGOL.TCPServer.{0}'.format(port)) # TCP server to listen for control commands self.tcp_server = QTcpServer() # TCP server listenning port self.tcp_port = port # TCP socket connection self.tcp_connection = None
def __init__(self, mainWindow): QObject.__init__(self) self.__mainWindow = mainWindow self.__processes = [] self.__tcpServer = QTcpServer() self.connect(self.__tcpServer, SIGNAL("newConnection()"), self.__newConnection) self.__tcpServer.listen(QHostAddress.LocalHost) self.__waitTimer = QTimer(self) self.__waitTimer.setSingleShot(True) self.connect(self.__waitTimer, SIGNAL('timeout()'), self.__onWaitImer) return
def __init__(self, name, dimensions, port, resource_path): QObject.__init__(self) self.port = int(port) self.server = QTcpServer(self) self.connect(self.server, QtCore.SIGNAL("newConnection()"), self.newConnection) self.server.listen(Qt.QHostAddress(Qt.QHostAddress.Any), self.port) print " --- iVisServer --- Listening on port: ", str(port) self.sockets = {} self.buffer = '' self.devices = {} self.vistrailServer = VistrailServer(resource_path) self.summary = None self.addDevice(name, dimensions) self.userPool = UserPool()
def StartServer(self): self.host = "localhost" self.port = int(self.ui.port_Edit.text()) self.ui.inbuffer_Edit.append("ServerStart on port:" + str(self.port)) self.timestamp = datetime.datetime.now() self.tcpServer = QTcpServer(self) self.tcpServer.listen(QHostAddress(self.host), self.port) curtime = datetime.datetime.now() delta = curtime - self.timestamp self.time_delta = delta.total_seconds() self.scanman.ui.fitGroupBox.fittedsignal.connect(self.GetCurrent) self.connections = [] self.connect(self.tcpServer, qtCore.SIGNAL("newConnection()"), self.addConnection) self.ui.status_Edit.setText("On") True
def isAvailable(port): server = QTcpServer() result = server.listen(QHostAddress("127.0.0.1"), port) server.close() return result
def __init__(self, parent=None): super(Dialog, self).__init__(parent) self.settings = QSettings('settings.ini', QSettings.IniFormat) self.tcpServer = QTcpServer() self.chBox = QCheckBox("Print log to window") self.text = QPlainTextEdit() self.serverStatusLabel = QLabel("Server ready") self.lblFileName = QLabel("Choose file before start!") self.saveButton = QPushButton("&Choose file...") self.startButton = QPushButton("&Start") self.stopButton = QPushButton("S&top") self.quitButton = QPushButton("&Quit") self.file = None self.tcpServerConnection = None self._lineCounter = 0 self._lineBuf = '' buttonBox = QDialogButtonBox() buttonBox.addButton(self.startButton, QDialogButtonBox.ActionRole) buttonBox.addButton(self.stopButton, QDialogButtonBox.RejectRole) buttonBox.addButton(self.quitButton, QDialogButtonBox.RejectRole) clearButon = QPushButton('&Clear') self.saveButton.clicked.connect(self.savedlg) self.startButton.clicked.connect(self.start) self.stopButton.clicked.connect(self.stopClicked) self.quitButton.clicked.connect(self.close) clearButon.clicked.connect(self.text.clear) self.tcpServer.newConnection.connect(self.acceptConnection) saveLayout = QHBoxLayout() saveLayout.addWidget(self.lblFileName) saveLayout.addStretch(1) saveLayout.addWidget(self.saveButton) topTextLayout = QHBoxLayout() topTextLayout.addWidget(self.chBox) topTextLayout.addStretch(1) topTextLayout.addWidget(clearButon) mainLayout = QVBoxLayout() mainLayout.addLayout(saveLayout) mainLayout.addLayout(topTextLayout) mainLayout.addWidget(self.text) mainLayout.addWidget(self.serverStatusLabel) # mainLayout.addStretch(1) mainLayout.addSpacing(10) mainLayout.addWidget(buttonBox) self.setLayout(mainLayout) self.title = "Simple Logger" self.ver = '1.0' self.setWindowIcon(QIcon('./icon.png')) self.setWindowTitle("{} {}".format(self.title, self.ver))