10430:e440aaf179ce | 10431:64157aeb0312 |
---|---|
23 | 23 |
24 def __init__(self, name): | 24 def __init__(self, name): |
25 """ | 25 """ |
26 Constructor | 26 Constructor |
27 | 27 |
28 @param name name this server is listening to (string) | 28 @param name name this server is listening to |
29 @type str | |
29 """ | 30 """ |
30 super().__init__() | 31 super().__init__() |
31 | 32 |
32 res = self.listen(name) | 33 res = self.listen(name) |
33 if not res: | 34 if not res: |
128 | 129 |
129 def __init__(self, name): | 130 def __init__(self, name): |
130 """ | 131 """ |
131 Constructor | 132 Constructor |
132 | 133 |
133 @param name name of the local server to connect to (string) | 134 @param name name of the local server to connect to |
135 @type str | |
134 """ | 136 """ |
135 self.name = name | 137 self.name = name |
136 self.connected = False | 138 self.connected = False |
137 | 139 |
138 def connect(self, timeout=10000): | 140 def connect(self, timeout=10000): |
144 @return value indicating success or an error number. Value is one of: | 146 @return value indicating success or an error number. Value is one of: |
145 <table> | 147 <table> |
146 <tr><td>0</td><td>No application is running</td></tr> | 148 <tr><td>0</td><td>No application is running</td></tr> |
147 <tr><td>1</td><td>Application is already running</td></tr> | 149 <tr><td>1</td><td>Application is already running</td></tr> |
148 </table> | 150 </table> |
151 @rtype int | |
149 """ | 152 """ |
150 self.sock = QLocalSocket() | 153 self.sock = QLocalSocket() |
151 self.sock.connectToServer(self.name) | 154 self.sock.connectToServer(self.name) |
152 if self.sock.waitForConnected(timeout): | 155 if self.sock.waitForConnected(timeout): |
153 self.connected = True | 156 self.connected = True |
200 | 203 |
201 def errstr(self): | 204 def errstr(self): |
202 """ | 205 """ |
203 Public method to return a meaningful error string for the last error. | 206 Public method to return a meaningful error string for the last error. |
204 | 207 |
205 @return error string for the last error (string) | 208 @return error string for the last error |
209 @rtype str | |
206 """ | 210 """ |
207 return self.sock.errorString() | 211 return self.sock.errorString() |