src/eric7/Cooperation/CooperationServer.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
16 16
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 22 @signal newConnection(connection) emitted after a new connection was
23 received (Connection) 23 received (Connection)
24 """ 24 """
25
25 newConnection = pyqtSignal(Connection) 26 newConnection = pyqtSignal(Connection)
26 27
27 def __init__(self, address, parent=None): 28 def __init__(self, address, parent=None):
28 """ 29 """
29 Constructor 30 Constructor
30 31
31 @param address address the server should listen on (QHostAddress) 32 @param address address the server should listen on (QHostAddress)
32 @param parent reference to the parent object (QObject) 33 @param parent reference to the parent object (QObject)
33 """ 34 """
34 super().__init__(parent) 35 super().__init__(parent)
35 36
36 self.__address = address 37 self.__address = address
37 38
38 def incomingConnection(self, socketDescriptor): 39 def incomingConnection(self, socketDescriptor):
39 """ 40 """
40 Public method handling an incoming connection. 41 Public method handling an incoming connection.
41 42
42 @param socketDescriptor native socket descriptor (integer) 43 @param socketDescriptor native socket descriptor (integer)
43 """ 44 """
44 connection = Connection(self) 45 connection = Connection(self)
45 connection.setSocketDescriptor(socketDescriptor) 46 connection.setSocketDescriptor(socketDescriptor)
46 self.newConnection.emit(connection) 47 self.newConnection.emit(connection)
47 48
48 def startListening(self, port=-1, findFreePort=False): 49 def startListening(self, port=-1, findFreePort=False):
49 """ 50 """
50 Public method to start listening for new connections. 51 Public method to start listening for new connections.
51 52
52 @param port port to listen on (integer) 53 @param port port to listen on (integer)
53 @param findFreePort flag indicating to search for a free port 54 @param findFreePort flag indicating to search for a free port
54 depending on the configuration (boolean) 55 depending on the configuration (boolean)
55 @return tuple giving a flag indicating success (boolean) and 56 @return tuple giving a flag indicating success (boolean) and
56 the port the server listens on 57 the port the server listens on

eric ide

mercurial