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