19 |
19 |
20 class CooperationServer(QTcpServer): |
20 class CooperationServer(QTcpServer): |
21 """ |
21 """ |
22 Class implementing the cooperation server. |
22 Class implementing the cooperation server. |
23 |
23 |
24 @signal newConnection(connection) emitted after a new connection was received |
24 @signal newConnection(connection) emitted after a new connection was |
25 (Connection) |
25 received (Connection) |
26 """ |
26 """ |
27 newConnection = pyqtSignal(Connection) |
27 newConnection = pyqtSignal(Connection) |
28 |
28 |
29 def __init__(self, address, parent=None): |
29 def __init__(self, address, parent=None): |
30 """ |
30 """ |
50 def startListening(self, port=-1, findFreePort=False): |
50 def startListening(self, port=-1, findFreePort=False): |
51 """ |
51 """ |
52 Public method to start listening for new connections. |
52 Public method to start listening for new connections. |
53 |
53 |
54 @param port port to listen on (integer) |
54 @param port port to listen on (integer) |
55 @param findFreePort flag indicating to search for a free port depending on |
55 @param findFreePort flag indicating to search for a free port |
56 the configuration (boolean) |
56 depending on the configuration (boolean) |
57 @return tuple giving a flag indicating success (boolean) and |
57 @return tuple giving a flag indicating success (boolean) and |
58 the port the server listens on |
58 the port the server listens on |
59 """ |
59 """ |
60 res = self.listen(self.__address, port) |
60 res = self.listen(self.__address, port) |
61 if findFreePort and Preferences.getCooperation("TryOtherPorts"): |
61 if findFreePort and Preferences.getCooperation("TryOtherPorts"): |