src/eric7/Documentation/Source/eric7.Cooperation.Connection.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 10423
299802979277
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Cooperation.Connection</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Cooperation.Connection</h1>
10
11 <p>
12 Module implementing a class representing a peer connection.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>MaxBufferSize</td></tr><tr><td>PingInterval</td></tr><tr><td>PongTimeout</td></tr><tr><td>SeparatorToken</td></tr><tr><td>SeparatorToken_b</td></tr><tr><td>TransferTimeout</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#Connection">Connection</a></td>
25 <td>Class representing a peer connection.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <hr />
34 <hr />
35 <a NAME="Connection" ID="Connection"></a>
36 <h2>Connection</h2>
37
38 <p>
39 Class representing a peer connection.
40 </p>
41 <h3>Signals</h3>
42 <dl>
43
44 <dt>editorCommand(hash, fn, message)</dt>
45 <dd>
46 emitted after an editor command
47 has arrived (string, string, string)
48 </dd>
49 <dt>getParticipants()</dt>
50 <dd>
51 emitted after a get participants message has
52 arrived
53 </dd>
54 <dt>newMessage(user, message)</dt>
55 <dd>
56 emitted after a new message has
57 arrived (string, string)
58 </dd>
59 <dt>participants(participants)</dt>
60 <dd>
61 emitted after the list of participants
62 has arrived (list of strings of "host:port")
63 </dd>
64 <dt>readyForUse()</dt>
65 <dd>
66 emitted when the connection is ready for use
67 </dd>
68 <dt>rejected(message)</dt>
69 <dd>
70 emitted after a connection has been rejected
71 (string)
72 </dd>
73 </dl>
74 <h3>Derived from</h3>
75 QTcpSocket
76 <h3>Class Attributes</h3>
77
78 <table>
79 <tr><td>Editor</td></tr><tr><td>GetParticipants</td></tr><tr><td>Greeting</td></tr><tr><td>Participants</td></tr><tr><td>Ping</td></tr><tr><td>PlainText</td></tr><tr><td>Pong</td></tr><tr><td>ProtocolEditor</td></tr><tr><td>ProtocolGetParticipants</td></tr><tr><td>ProtocolGreeting</td></tr><tr><td>ProtocolMessage</td></tr><tr><td>ProtocolParticipants</td></tr><tr><td>ProtocolPing</td></tr><tr><td>ProtocolPong</td></tr><tr><td>ReadingGreeting</td></tr><tr><td>ReadyForUse</td></tr><tr><td>Undefined</td></tr><tr><td>WaitingForGreeting</td></tr>
80 </table>
81 <h3>Class Methods</h3>
82
83 <table>
84 <tr><td>None</td></tr>
85 </table>
86 <h3>Methods</h3>
87
88 <table>
89
90 <tr>
91 <td><a href="#Connection.__init__">Connection</a></td>
92 <td>Constructor</td>
93 </tr>
94 <tr>
95 <td><a href="#Connection.__dataLengthForCurrentDataType">__dataLengthForCurrentDataType</a></td>
96 <td>Private method to get the data length for the current data type.</td>
97 </tr>
98 <tr>
99 <td><a href="#Connection.__disconnected">__disconnected</a></td>
100 <td>Private slot to handle the connection being dropped.</td>
101 </tr>
102 <tr>
103 <td><a href="#Connection.__hasEnoughData">__hasEnoughData</a></td>
104 <td>Private method to check, if enough data is available.</td>
105 </tr>
106 <tr>
107 <td><a href="#Connection.__processData">__processData</a></td>
108 <td>Private method to process the received data.</td>
109 </tr>
110 <tr>
111 <td><a href="#Connection.__processReadyRead">__processReadyRead</a></td>
112 <td>Private slot to handle the readyRead signal.</td>
113 </tr>
114 <tr>
115 <td><a href="#Connection.__readDataIntoBuffer">__readDataIntoBuffer</a></td>
116 <td>Private method to read some data into the buffer.</td>
117 </tr>
118 <tr>
119 <td><a href="#Connection.__readProtocolHeader">__readProtocolHeader</a></td>
120 <td>Private method to read the protocol header.</td>
121 </tr>
122 <tr>
123 <td><a href="#Connection.__sendGreetingMessage">__sendGreetingMessage</a></td>
124 <td>Private slot to send a greeting message.</td>
125 </tr>
126 <tr>
127 <td><a href="#Connection.__sendPing">__sendPing</a></td>
128 <td>Private slot to send a ping message.</td>
129 </tr>
130 <tr>
131 <td><a href="#Connection.name">name</a></td>
132 <td>Public method to get the connection name.</td>
133 </tr>
134 <tr>
135 <td><a href="#Connection.sendEditorCommand">sendEditorCommand</a></td>
136 <td>Public method to send an editor command.</td>
137 </tr>
138 <tr>
139 <td><a href="#Connection.sendGetParticipants">sendGetParticipants</a></td>
140 <td>Public method to request a list of participants.</td>
141 </tr>
142 <tr>
143 <td><a href="#Connection.sendMessage">sendMessage</a></td>
144 <td>Public method to send a message.</td>
145 </tr>
146 <tr>
147 <td><a href="#Connection.sendParticipants">sendParticipants</a></td>
148 <td>Public method to send the list of participants.</td>
149 </tr>
150 <tr>
151 <td><a href="#Connection.serverPort">serverPort</a></td>
152 <td>Public method to get the server port.</td>
153 </tr>
154 <tr>
155 <td><a href="#Connection.setClient">setClient</a></td>
156 <td>Public method to set the reference to the cooperation client.</td>
157 </tr>
158 <tr>
159 <td><a href="#Connection.setGreetingMessage">setGreetingMessage</a></td>
160 <td>Public method to set the greeting message.</td>
161 </tr>
162 <tr>
163 <td><a href="#Connection.timerEvent">timerEvent</a></td>
164 <td>Protected method to handle timer events.</td>
165 </tr>
166 </table>
167 <h3>Static Methods</h3>
168
169 <table>
170 <tr><td>None</td></tr>
171 </table>
172
173 <a NAME="Connection.__init__" ID="Connection.__init__"></a>
174 <h4>Connection (Constructor)</h4>
175 <b>Connection</b>(<i>parent=None</i>)
176
177 <p>
178 Constructor
179 </p>
180 <dl>
181
182 <dt><i>parent</i></dt>
183 <dd>
184 referenec to the parent object (QObject)
185 </dd>
186 </dl>
187 <a NAME="Connection.__dataLengthForCurrentDataType" ID="Connection.__dataLengthForCurrentDataType"></a>
188 <h4>Connection.__dataLengthForCurrentDataType</h4>
189 <b>__dataLengthForCurrentDataType</b>(<i></i>)
190
191 <p>
192 Private method to get the data length for the current data type.
193 </p>
194 <dl>
195 <dt>Return:</dt>
196 <dd>
197 data length (integer)
198 </dd>
199 </dl>
200 <a NAME="Connection.__disconnected" ID="Connection.__disconnected"></a>
201 <h4>Connection.__disconnected</h4>
202 <b>__disconnected</b>(<i></i>)
203
204 <p>
205 Private slot to handle the connection being dropped.
206 </p>
207 <a NAME="Connection.__hasEnoughData" ID="Connection.__hasEnoughData"></a>
208 <h4>Connection.__hasEnoughData</h4>
209 <b>__hasEnoughData</b>(<i></i>)
210
211 <p>
212 Private method to check, if enough data is available.
213 </p>
214 <dl>
215 <dt>Return:</dt>
216 <dd>
217 flag indicating availability of enough data (boolean)
218 </dd>
219 </dl>
220 <a NAME="Connection.__processData" ID="Connection.__processData"></a>
221 <h4>Connection.__processData</h4>
222 <b>__processData</b>(<i></i>)
223
224 <p>
225 Private method to process the received data.
226 </p>
227 <a NAME="Connection.__processReadyRead" ID="Connection.__processReadyRead"></a>
228 <h4>Connection.__processReadyRead</h4>
229 <b>__processReadyRead</b>(<i></i>)
230
231 <p>
232 Private slot to handle the readyRead signal.
233 </p>
234 <a NAME="Connection.__readDataIntoBuffer" ID="Connection.__readDataIntoBuffer"></a>
235 <h4>Connection.__readDataIntoBuffer</h4>
236 <b>__readDataIntoBuffer</b>(<i>maxSize=MaxBufferSize</i>)
237
238 <p>
239 Private method to read some data into the buffer.
240 </p>
241 <dl>
242
243 <dt><i>maxSize</i></dt>
244 <dd>
245 maximum size of data to read (integer)
246 </dd>
247 </dl>
248 <dl>
249 <dt>Return:</dt>
250 <dd>
251 size of data read (integer)
252 </dd>
253 </dl>
254 <a NAME="Connection.__readProtocolHeader" ID="Connection.__readProtocolHeader"></a>
255 <h4>Connection.__readProtocolHeader</h4>
256 <b>__readProtocolHeader</b>(<i></i>)
257
258 <p>
259 Private method to read the protocol header.
260 </p>
261 <dl>
262 <dt>Return:</dt>
263 <dd>
264 flag indicating a successful read (boolean)
265 </dd>
266 </dl>
267 <a NAME="Connection.__sendGreetingMessage" ID="Connection.__sendGreetingMessage"></a>
268 <h4>Connection.__sendGreetingMessage</h4>
269 <b>__sendGreetingMessage</b>(<i></i>)
270
271 <p>
272 Private slot to send a greeting message.
273 </p>
274 <a NAME="Connection.__sendPing" ID="Connection.__sendPing"></a>
275 <h4>Connection.__sendPing</h4>
276 <b>__sendPing</b>(<i></i>)
277
278 <p>
279 Private slot to send a ping message.
280 </p>
281 <a NAME="Connection.name" ID="Connection.name"></a>
282 <h4>Connection.name</h4>
283 <b>name</b>(<i></i>)
284
285 <p>
286 Public method to get the connection name.
287 </p>
288 <dl>
289 <dt>Return:</dt>
290 <dd>
291 connection name (string)
292 </dd>
293 </dl>
294 <a NAME="Connection.sendEditorCommand" ID="Connection.sendEditorCommand"></a>
295 <h4>Connection.sendEditorCommand</h4>
296 <b>sendEditorCommand</b>(<i>projectHash, filename, message</i>)
297
298 <p>
299 Public method to send an editor command.
300 </p>
301 <dl>
302
303 <dt><i>projectHash</i></dt>
304 <dd>
305 hash of the project (string)
306 </dd>
307 <dt><i>filename</i></dt>
308 <dd>
309 project relative universal file name of
310 the sending editor (string)
311 </dd>
312 <dt><i>message</i></dt>
313 <dd>
314 editor command to be sent (string)
315 </dd>
316 </dl>
317 <a NAME="Connection.sendGetParticipants" ID="Connection.sendGetParticipants"></a>
318 <h4>Connection.sendGetParticipants</h4>
319 <b>sendGetParticipants</b>(<i></i>)
320
321 <p>
322 Public method to request a list of participants.
323 </p>
324 <a NAME="Connection.sendMessage" ID="Connection.sendMessage"></a>
325 <h4>Connection.sendMessage</h4>
326 <b>sendMessage</b>(<i>message</i>)
327
328 <p>
329 Public method to send a message.
330 </p>
331 <dl>
332
333 <dt><i>message</i></dt>
334 <dd>
335 message to be sent (string)
336 </dd>
337 </dl>
338 <dl>
339 <dt>Return:</dt>
340 <dd>
341 flag indicating a successful send (boolean)
342 </dd>
343 </dl>
344 <a NAME="Connection.sendParticipants" ID="Connection.sendParticipants"></a>
345 <h4>Connection.sendParticipants</h4>
346 <b>sendParticipants</b>(<i>participants</i>)
347
348 <p>
349 Public method to send the list of participants.
350 </p>
351 <dl>
352
353 <dt><i>participants</i></dt>
354 <dd>
355 list of participants (list of strings of
356 "host:port")
357 </dd>
358 </dl>
359 <a NAME="Connection.serverPort" ID="Connection.serverPort"></a>
360 <h4>Connection.serverPort</h4>
361 <b>serverPort</b>(<i></i>)
362
363 <p>
364 Public method to get the server port.
365 </p>
366 <dl>
367 <dt>Return:</dt>
368 <dd>
369 server port (integer)
370 </dd>
371 </dl>
372 <a NAME="Connection.setClient" ID="Connection.setClient"></a>
373 <h4>Connection.setClient</h4>
374 <b>setClient</b>(<i>client</i>)
375
376 <p>
377 Public method to set the reference to the cooperation client.
378 </p>
379 <dl>
380
381 <dt><i>client</i></dt>
382 <dd>
383 reference to the cooperation client (CooperationClient)
384 </dd>
385 </dl>
386 <a NAME="Connection.setGreetingMessage" ID="Connection.setGreetingMessage"></a>
387 <h4>Connection.setGreetingMessage</h4>
388 <b>setGreetingMessage</b>(<i>message, serverPort</i>)
389
390 <p>
391 Public method to set the greeting message.
392 </p>
393 <dl>
394
395 <dt><i>message</i></dt>
396 <dd>
397 greeting message (string)
398 </dd>
399 <dt><i>serverPort</i></dt>
400 <dd>
401 port number to include in the message (integer)
402 </dd>
403 </dl>
404 <a NAME="Connection.timerEvent" ID="Connection.timerEvent"></a>
405 <h4>Connection.timerEvent</h4>
406 <b>timerEvent</b>(<i>evt</i>)
407
408 <p>
409 Protected method to handle timer events.
410 </p>
411 <dl>
412
413 <dt><i>evt</i></dt>
414 <dd>
415 reference to the timer event (QTimerEvent)
416 </dd>
417 </dl>
418 <div align="right"><a href="#top">Up</a></div>
419 <hr />
420 </body></html>

eric ide

mercurial