|
@@ -0,0 +1,708 @@
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+<!DOCTYPE html>
|
|
4
|
+<html class="writer-html4" lang="en" >
|
|
5
|
+<head>
|
|
6
|
+ <meta charset="utf-8">
|
|
7
|
+
|
|
8
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
|
|
10
|
+ <title>Welcome to tcp_socket’s documentation! — tcp_socket documentation</title>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+ <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
|
15
|
+ <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+ <!--[if lt IE 9]>
|
|
24
|
+ <script src="_static/js/html5shiv.min.js"></script>
|
|
25
|
+ <![endif]-->
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+ <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
|
29
|
+ <script type="text/javascript" src="_static/jquery.js"></script>
|
|
30
|
+ <script type="text/javascript" src="_static/underscore.js"></script>
|
|
31
|
+ <script type="text/javascript" src="_static/doctools.js"></script>
|
|
32
|
+ <script type="text/javascript" src="_static/language_data.js"></script>
|
|
33
|
+
|
|
34
|
+ <script type="text/javascript" src="_static/js/theme.js"></script>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+ <link rel="index" title="Index" href="genindex.html" />
|
|
38
|
+ <link rel="search" title="Search" href="search.html" />
|
|
39
|
+</head>
|
|
40
|
+
|
|
41
|
+<body class="wy-body-for-nav">
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+ <div class="wy-grid-for-nav">
|
|
45
|
+
|
|
46
|
+ <nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
47
|
+ <div class="wy-side-scroll">
|
|
48
|
+ <div class="wy-side-nav-search" >
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+ <a href="#" class="icon icon-home" alt="Documentation Home"> tcp_socket
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+ </a>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+<div role="search">
|
|
65
|
+ <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
66
|
+ <input type="text" name="q" placeholder="Search docs" />
|
|
67
|
+ <input type="hidden" name="check_keywords" value="yes" />
|
|
68
|
+ <input type="hidden" name="area" value="default" />
|
|
69
|
+ </form>
|
|
70
|
+</div>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+ </div>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+ <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+ <!-- Local TOC -->
|
|
84
|
+ <div class="local-toc"><ul>
|
|
85
|
+<li><a class="reference internal" href="#">Welcome to tcp_socket’s documentation!</a><ul>
|
|
86
|
+<li><a class="reference internal" href="#tcp-socket-tcp-socket">tcp_socket (TCP Socket)</a></li>
|
|
87
|
+</ul>
|
|
88
|
+</li>
|
|
89
|
+<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
|
|
90
|
+</ul>
|
|
91
|
+</div>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+ </div>
|
|
95
|
+
|
|
96
|
+ </div>
|
|
97
|
+ </nav>
|
|
98
|
+
|
|
99
|
+ <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+ <nav class="wy-nav-top" aria-label="top navigation">
|
|
103
|
+
|
|
104
|
+ <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
105
|
+ <a href="#">tcp_socket</a>
|
|
106
|
+
|
|
107
|
+ </nav>
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+ <div class="wy-nav-content">
|
|
111
|
+
|
|
112
|
+ <div class="rst-content">
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+<div role="navigation" aria-label="breadcrumbs navigation">
|
|
131
|
+
|
|
132
|
+ <ul class="wy-breadcrumbs">
|
|
133
|
+
|
|
134
|
+ <li><a href="#" class="icon icon-home"></a> »</li>
|
|
135
|
+
|
|
136
|
+ <li>Welcome to tcp_socket’s documentation!</li>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+ <li class="wy-breadcrumbs-aside">
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+ <a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+ </li>
|
|
146
|
+
|
|
147
|
+ </ul>
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+ <hr/>
|
|
151
|
+</div>
|
|
152
|
+ <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
153
|
+ <div itemprop="articleBody">
|
|
154
|
+
|
|
155
|
+ <div class="section" id="module-tcp_socket">
|
|
156
|
+<span id="welcome-to-tcp-socket-s-documentation"></span><h1>Welcome to tcp_socket’s documentation!<a class="headerlink" href="#module-tcp_socket" title="Permalink to this headline">¶</a></h1>
|
|
157
|
+<div class="section" id="tcp-socket-tcp-socket">
|
|
158
|
+<h2>tcp_socket (TCP Socket)<a class="headerlink" href="#tcp-socket-tcp-socket" title="Permalink to this headline">¶</a></h2>
|
|
159
|
+<p><strong>Author:</strong></p>
|
|
160
|
+<ul class="simple">
|
|
161
|
+<li>Dirk Alders <<a class="reference external" href="mailto:sudo-dirk%40mount-mockery.de">sudo-dirk<span>@</span>mount-mockery<span>.</span>de</a>></li>
|
|
162
|
+</ul>
|
|
163
|
+<p><strong>Description:</strong></p>
|
|
164
|
+<blockquote>
|
|
165
|
+<div>This Module supports a client/ server tcp socket connection.</div></blockquote>
|
|
166
|
+<p><strong>Submodules:</strong></p>
|
|
167
|
+<ul class="simple">
|
|
168
|
+<li><a class="reference internal" href="#tcp_socket.tcp_client" title="tcp_socket.tcp_client"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_socket.tcp_client</span></code></a></li>
|
|
169
|
+<li><a class="reference internal" href="#tcp_socket.tcp_client_stp" title="tcp_socket.tcp_client_stp"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_socket.tcp_client_stp</span></code></a></li>
|
|
170
|
+<li><a class="reference internal" href="#tcp_socket.tcp_server" title="tcp_socket.tcp_server"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_socket.tcp_server</span></code></a></li>
|
|
171
|
+<li><a class="reference internal" href="#tcp_socket.tcp_server_stp" title="tcp_socket.tcp_server_stp"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_socket.tcp_server_stp</span></code></a></li>
|
|
172
|
+</ul>
|
|
173
|
+<p><strong>Unittest:</strong></p>
|
|
174
|
+<blockquote>
|
|
175
|
+<div>See also the <a class="reference download internal" download="" href="_downloads/e4086ba3197d1869e430d0a75a9a48e9/unittest.pdf"><code class="xref download docutils literal notranslate"><span class="pre">unittest</span></code></a> documentation.</div></blockquote>
|
|
176
|
+<p><strong>Module Documentation:</strong></p>
|
|
177
|
+<dl class="class">
|
|
178
|
+<dt id="tcp_socket.tcp_base">
|
|
179
|
+<em class="property">class </em><code class="descclassname">tcp_socket.</code><code class="descname">tcp_base</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base" title="Permalink to this definition">¶</a></dt>
|
|
180
|
+<dd><p>This is the base class for other classes in this module.</p>
|
|
181
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
182
|
+<col class="field-name" />
|
|
183
|
+<col class="field-body" />
|
|
184
|
+<tbody valign="top">
|
|
185
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
|
186
|
+<li><strong>host</strong> (<em>str</em>) – The host IP for the TCP socket functionality</li>
|
|
187
|
+<li><strong>port</strong> (<em>int</em>) – The port for the TCP socket functionality</li>
|
|
188
|
+<li><strong>channel_name</strong> (<em>str</em>) – The name for the logging channel</li>
|
|
189
|
+</ul>
|
|
190
|
+</td>
|
|
191
|
+</tr>
|
|
192
|
+</tbody>
|
|
193
|
+</table>
|
|
194
|
+<div class="admonition note">
|
|
195
|
+<p class="first admonition-title">Note</p>
|
|
196
|
+<p class="last">This class is not designed for direct usage.</p>
|
|
197
|
+</div>
|
|
198
|
+<dl class="method">
|
|
199
|
+<dt id="tcp_socket.tcp_base.client_address">
|
|
200
|
+<code class="descname">client_address</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.client_address" title="Permalink to this definition">¶</a></dt>
|
|
201
|
+<dd><p>This method returns the address of the connected client.</p>
|
|
202
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
203
|
+<col class="field-name" />
|
|
204
|
+<col class="field-body" />
|
|
205
|
+<tbody valign="top">
|
|
206
|
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The client address.</td>
|
|
207
|
+</tr>
|
|
208
|
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">str</td>
|
|
209
|
+</tr>
|
|
210
|
+</tbody>
|
|
211
|
+</table>
|
|
212
|
+</dd></dl>
|
|
213
|
+
|
|
214
|
+<dl class="method">
|
|
215
|
+<dt id="tcp_socket.tcp_base.close">
|
|
216
|
+<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.close" title="Permalink to this definition">¶</a></dt>
|
|
217
|
+<dd><p>This method closes the connected communication channel, if exists.</p>
|
|
218
|
+</dd></dl>
|
|
219
|
+
|
|
220
|
+<dl class="method">
|
|
221
|
+<dt id="tcp_socket.tcp_base.init_channel_name">
|
|
222
|
+<code class="descname">init_channel_name</code><span class="sig-paren">(</span><em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.init_channel_name" title="Permalink to this definition">¶</a></dt>
|
|
223
|
+<dd><p>With this Method, the channel name for logging can be changed.</p>
|
|
224
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
225
|
+<col class="field-name" />
|
|
226
|
+<col class="field-body" />
|
|
227
|
+<tbody valign="top">
|
|
228
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>channel_name</strong> (<em>str</em>) – The name for the logging channel</td>
|
|
229
|
+</tr>
|
|
230
|
+</tbody>
|
|
231
|
+</table>
|
|
232
|
+</dd></dl>
|
|
233
|
+
|
|
234
|
+<dl class="method">
|
|
235
|
+<dt id="tcp_socket.tcp_base.is_connected">
|
|
236
|
+<code class="descname">is_connected</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.is_connected" title="Permalink to this definition">¶</a></dt>
|
|
237
|
+<dd><p>With this Method the connection status can be identified.</p>
|
|
238
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
239
|
+<col class="field-name" />
|
|
240
|
+<col class="field-body" />
|
|
241
|
+<tbody valign="top">
|
|
242
|
+<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True, if a connection is established, otherwise False.</td>
|
|
243
|
+</tr>
|
|
244
|
+<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
|
|
245
|
+</tr>
|
|
246
|
+</tbody>
|
|
247
|
+</table>
|
|
248
|
+</dd></dl>
|
|
249
|
+
|
|
250
|
+<dl class="method">
|
|
251
|
+<dt id="tcp_socket.tcp_base.receive">
|
|
252
|
+<code class="descname">receive</code><span class="sig-paren">(</span><em>timeout=1</em>, <em>num=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.receive" title="Permalink to this definition">¶</a></dt>
|
|
253
|
+<dd><p>This method returns received data.</p>
|
|
254
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
255
|
+<col class="field-name" />
|
|
256
|
+<col class="field-body" />
|
|
257
|
+<tbody valign="top">
|
|
258
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
|
259
|
+<li><strong>timeout</strong> (<em>float</em>) – The timeout for receiving data (at least after the timeout the method returns data or None).</li>
|
|
260
|
+<li><strong>num</strong> (<em>int</em>) – the number of bytes to receive (use None to get all available data).</li>
|
|
261
|
+</ul>
|
|
262
|
+</td>
|
|
263
|
+</tr>
|
|
264
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The received data.</p>
|
|
265
|
+</td>
|
|
266
|
+</tr>
|
|
267
|
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bytes</p>
|
|
268
|
+</td>
|
|
269
|
+</tr>
|
|
270
|
+</tbody>
|
|
271
|
+</table>
|
|
272
|
+</dd></dl>
|
|
273
|
+
|
|
274
|
+<dl class="method">
|
|
275
|
+<dt id="tcp_socket.tcp_base.register_callback">
|
|
276
|
+<code class="descname">register_callback</code><span class="sig-paren">(</span><em>callback</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.register_callback" title="Permalink to this definition">¶</a></dt>
|
|
277
|
+<dd><p>This method stores the callback which is executed, if data is available. You need to execute <a class="reference internal" href="#tcp_socket.tcp_base.receive" title="tcp_socket.tcp_base.receive"><code class="xref py py-func docutils literal notranslate"><span class="pre">receive()</span></code></a> of this instance
|
|
278
|
+given as first argument.</p>
|
|
279
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
280
|
+<col class="field-name" />
|
|
281
|
+<col class="field-body" />
|
|
282
|
+<tbody valign="top">
|
|
283
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>callback</strong> – The callback which will be executed, when data is available.</td>
|
|
284
|
+</tr>
|
|
285
|
+</tbody>
|
|
286
|
+</table>
|
|
287
|
+</dd></dl>
|
|
288
|
+
|
|
289
|
+<dl class="method">
|
|
290
|
+<dt id="tcp_socket.tcp_base.register_connect_callback">
|
|
291
|
+<code class="descname">register_connect_callback</code><span class="sig-paren">(</span><em>callback</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.register_connect_callback" title="Permalink to this definition">¶</a></dt>
|
|
292
|
+<dd><p>This method stores the callback which is executed, if a connection is established.</p>
|
|
293
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
294
|
+<col class="field-name" />
|
|
295
|
+<col class="field-body" />
|
|
296
|
+<tbody valign="top">
|
|
297
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>callback</strong> – The callback which will be executed, when a connection is established.</td>
|
|
298
|
+</tr>
|
|
299
|
+</tbody>
|
|
300
|
+</table>
|
|
301
|
+</dd></dl>
|
|
302
|
+
|
|
303
|
+<dl class="method">
|
|
304
|
+<dt id="tcp_socket.tcp_base.register_disconnect_callback">
|
|
305
|
+<code class="descname">register_disconnect_callback</code><span class="sig-paren">(</span><em>callback</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.register_disconnect_callback" title="Permalink to this definition">¶</a></dt>
|
|
306
|
+<dd><p>This method stores the callback which is executed, after the connection is lost.</p>
|
|
307
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
308
|
+<col class="field-name" />
|
|
309
|
+<col class="field-body" />
|
|
310
|
+<tbody valign="top">
|
|
311
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>callback</strong> – The callback which will be executed, after the connection is lost.</td>
|
|
312
|
+</tr>
|
|
313
|
+</tbody>
|
|
314
|
+</table>
|
|
315
|
+</dd></dl>
|
|
316
|
+
|
|
317
|
+<dl class="method">
|
|
318
|
+<dt id="tcp_socket.tcp_base.send">
|
|
319
|
+<code class="descname">send</code><span class="sig-paren">(</span><em>data</em>, <em>timeout=1</em>, <em>log_lvl=20</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base.send" title="Permalink to this definition">¶</a></dt>
|
|
320
|
+<dd><p>This method sends data via the initiated communication channel.</p>
|
|
321
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
322
|
+<col class="field-name" />
|
|
323
|
+<col class="field-body" />
|
|
324
|
+<tbody valign="top">
|
|
325
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
|
326
|
+<li><strong>data</strong> (<em>bytes</em>) – The data to be send over the communication channel.</li>
|
|
327
|
+<li><strong>timeout</strong> (<em>float</em>) – The timeout for sending data (e.g. time to establish new connection).</li>
|
|
328
|
+<li><strong>log_lvl</strong> (<em>int</em>) – The log level to log outgoing TX-data</li>
|
|
329
|
+</ul>
|
|
330
|
+</td>
|
|
331
|
+</tr>
|
|
332
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if data had been sent, otherwise False.</p>
|
|
333
|
+</td>
|
|
334
|
+</tr>
|
|
335
|
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
|
|
336
|
+</td>
|
|
337
|
+</tr>
|
|
338
|
+</tbody>
|
|
339
|
+</table>
|
|
340
|
+</dd></dl>
|
|
341
|
+
|
|
342
|
+</dd></dl>
|
|
343
|
+
|
|
344
|
+<dl class="class">
|
|
345
|
+<dt id="tcp_socket.tcp_base_stp">
|
|
346
|
+<em class="property">class </em><code class="descclassname">tcp_socket.</code><code class="descname">tcp_base_stp</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base_stp" title="Permalink to this definition">¶</a></dt>
|
|
347
|
+<dd><p>This is the base class for other classes in this module. See also parent <a class="reference internal" href="#tcp_socket.tcp_base" title="tcp_socket.tcp_base"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_base</span></code></a>.</p>
|
|
348
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
349
|
+<col class="field-name" />
|
|
350
|
+<col class="field-body" />
|
|
351
|
+<tbody valign="top">
|
|
352
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
|
353
|
+<li><strong>host</strong> (<em>str</em>) – The host IP for the TCP socket functionality</li>
|
|
354
|
+<li><strong>port</strong> (<em>int</em>) – The port for the TCP socket functionality</li>
|
|
355
|
+<li><strong>channel_name</strong> (<em>str</em>) – The name for the logging channel</li>
|
|
356
|
+</ul>
|
|
357
|
+</td>
|
|
358
|
+</tr>
|
|
359
|
+</tbody>
|
|
360
|
+</table>
|
|
361
|
+<div class="admonition note">
|
|
362
|
+<p class="first admonition-title">Note</p>
|
|
363
|
+<p class="last">This class is not designed for direct usage.</p>
|
|
364
|
+</div>
|
|
365
|
+<dl class="method">
|
|
366
|
+<dt id="tcp_socket.tcp_base_stp.receive">
|
|
367
|
+<code class="descname">receive</code><span class="sig-paren">(</span><em>timeout=1</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base_stp.receive" title="Permalink to this definition">¶</a></dt>
|
|
368
|
+<dd><p>This method returns one received messages via the initiated communication channel.</p>
|
|
369
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
370
|
+<col class="field-name" />
|
|
371
|
+<col class="field-body" />
|
|
372
|
+<tbody valign="top">
|
|
373
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timeout</strong> (<em>float</em>) – The timeout for receiving data (at least after the timeout the method returns data or None).</td>
|
|
374
|
+</tr>
|
|
375
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The received data.</td>
|
|
376
|
+</tr>
|
|
377
|
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bytes</td>
|
|
378
|
+</tr>
|
|
379
|
+</tbody>
|
|
380
|
+</table>
|
|
381
|
+</dd></dl>
|
|
382
|
+
|
|
383
|
+<dl class="method">
|
|
384
|
+<dt id="tcp_socket.tcp_base_stp.send">
|
|
385
|
+<code class="descname">send</code><span class="sig-paren">(</span><em>data</em>, <em>timeout=1</em>, <em>log_lvl=20</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_base_stp.send" title="Permalink to this definition">¶</a></dt>
|
|
386
|
+<dd><p>This method sends one stp message via the initiated communication channel.</p>
|
|
387
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
388
|
+<col class="field-name" />
|
|
389
|
+<col class="field-body" />
|
|
390
|
+<tbody valign="top">
|
|
391
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
|
392
|
+<li><strong>data</strong> (<em>bytes</em>) – The message to be send over the communication channel.</li>
|
|
393
|
+<li><strong>timeout</strong> (<em>float</em>) – The timeout for sending data (e.g. time to establish new connection).</li>
|
|
394
|
+<li><strong>log_lvl</strong> (<em>int</em>) – The log level to log outgoing TX-data</li>
|
|
395
|
+</ul>
|
|
396
|
+</td>
|
|
397
|
+</tr>
|
|
398
|
+<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if data had been sent, otherwise False.</p>
|
|
399
|
+</td>
|
|
400
|
+</tr>
|
|
401
|
+<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
|
|
402
|
+</td>
|
|
403
|
+</tr>
|
|
404
|
+</tbody>
|
|
405
|
+</table>
|
|
406
|
+</dd></dl>
|
|
407
|
+
|
|
408
|
+</dd></dl>
|
|
409
|
+
|
|
410
|
+<dl class="class">
|
|
411
|
+<dt id="tcp_socket.tcp_client">
|
|
412
|
+<em class="property">class </em><code class="descclassname">tcp_socket.</code><code class="descname">tcp_client</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_client" title="Permalink to this definition">¶</a></dt>
|
|
413
|
+<dd><p>This class creates a tcp-client for transfering a serial stream of bytes (characters). See also parent <a class="reference internal" href="#tcp_socket.tcp_base" title="tcp_socket.tcp_base"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_base</span></code></a>.</p>
|
|
414
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
415
|
+<col class="field-name" />
|
|
416
|
+<col class="field-body" />
|
|
417
|
+<tbody valign="top">
|
|
418
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
|
419
|
+<li><strong>host</strong> (<em>str</em>) – The host IP for the TCP socket functionality</li>
|
|
420
|
+<li><strong>port</strong> (<em>int</em>) – The port for the TCP socket functionality</li>
|
|
421
|
+<li><strong>channel_name</strong> (<em>str</em>) – The name for the logging channel</li>
|
|
422
|
+</ul>
|
|
423
|
+</td>
|
|
424
|
+</tr>
|
|
425
|
+</tbody>
|
|
426
|
+</table>
|
|
427
|
+<div class="admonition note">
|
|
428
|
+<p class="first admonition-title">Note</p>
|
|
429
|
+<p class="last">You need a running <a class="reference internal" href="#tcp_socket.tcp_server" title="tcp_socket.tcp_server"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_server</span></code></a> listening at the given IP and Port to be able to communicate.</p>
|
|
430
|
+</div>
|
|
431
|
+<p><strong>Example:</strong></p>
|
|
432
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
|
433
|
+<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../..'</span><span class="p">)</span>
|
|
434
|
+
|
|
435
|
+<span class="kn">import</span> <span class="nn">report</span>
|
|
436
|
+<span class="kn">import</span> <span class="nn">tcp_socket</span>
|
|
437
|
+<span class="kn">import</span> <span class="nn">time</span>
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+<span class="k">def</span> <span class="nf">mirror_callback</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
|
|
441
|
+ <span class="k">return</span> <span class="n">data</span>
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+<span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="s1">'root'</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
|
|
445
|
+<span class="n">c</span> <span class="o">=</span> <span class="n">tcp_socket</span><span class="o">.</span><span class="n">tcp_client</span><span class="p">(</span><span class="s1">'127.0.0.1'</span><span class="p">,</span> <span class="mi">17000</span><span class="p">)</span>
|
|
446
|
+<span class="n">c</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="sa">b</span><span class="s1">'abc'</span><span class="p">)</span>
|
|
447
|
+<span class="nb">print</span><span class="p">(</span><span class="s1">'The Client received: </span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span> <span class="nb">repr</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">receive</span><span class="p">()))</span>
|
|
448
|
+</pre></div>
|
|
449
|
+</div>
|
|
450
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">310</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
451
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">462</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Connection</span> <span class="n">to</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">:</span><span class="mi">17000</span> <span class="n">established</span>
|
|
452
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">462</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
453
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">511</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">TX</span> <span class="o">-></span> <span class="s2">"(3): 61 62 63"</span>
|
|
454
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">563</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">RX</span> <span class="o"><-</span> <span class="s2">"(3): 61 62 63"</span>
|
|
455
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">612</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
456
|
+<span class="n">The</span> <span class="n">Client</span> <span class="n">received</span><span class="p">:</span> <span class="sa">b</span><span class="s1">'abc'</span>
|
|
457
|
+</pre></div>
|
|
458
|
+</div>
|
|
459
|
+</dd></dl>
|
|
460
|
+
|
|
461
|
+<dl class="class">
|
|
462
|
+<dt id="tcp_socket.tcp_client_stp">
|
|
463
|
+<em class="property">class </em><code class="descclassname">tcp_socket.</code><code class="descname">tcp_client_stp</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_client_stp" title="Permalink to this definition">¶</a></dt>
|
|
464
|
+<dd><p>This class creates a tcp-client for transfering a message. The bytes will be packed on send and unpacked on receive. See also parents <a class="reference internal" href="#tcp_socket.tcp_client" title="tcp_socket.tcp_client"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_client</span></code></a> and <a class="reference internal" href="#tcp_socket.tcp_base_stp" title="tcp_socket.tcp_base_stp"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_base_stp</span></code></a>.
|
|
465
|
+See <code class="xref py py-mod docutils literal notranslate"><span class="pre">stringtools.stp</span></code> for more information on packing and unpacking.</p>
|
|
466
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
467
|
+<col class="field-name" />
|
|
468
|
+<col class="field-body" />
|
|
469
|
+<tbody valign="top">
|
|
470
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
|
471
|
+<li><strong>host</strong> (<em>str</em>) – The host IP for the TCP socket functionality</li>
|
|
472
|
+<li><strong>port</strong> (<em>int</em>) – The port for the TCP socket functionality</li>
|
|
473
|
+<li><strong>channel_name</strong> (<em>str</em>) – The name for the logging channel</li>
|
|
474
|
+</ul>
|
|
475
|
+</td>
|
|
476
|
+</tr>
|
|
477
|
+</tbody>
|
|
478
|
+</table>
|
|
479
|
+<div class="admonition note">
|
|
480
|
+<p class="first admonition-title">Note</p>
|
|
481
|
+<p class="last">You need a running <a class="reference internal" href="#tcp_socket.tcp_server_stp" title="tcp_socket.tcp_server_stp"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_server_stp</span></code></a> listening at the given IP and Port to be able to communicate.</p>
|
|
482
|
+</div>
|
|
483
|
+<p><strong>Example:</strong></p>
|
|
484
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
|
485
|
+<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../..'</span><span class="p">)</span>
|
|
486
|
+
|
|
487
|
+<span class="kn">import</span> <span class="nn">report</span>
|
|
488
|
+<span class="kn">import</span> <span class="nn">tcp_socket</span>
|
|
489
|
+<span class="kn">import</span> <span class="nn">time</span>
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+<span class="k">def</span> <span class="nf">mirror_callback</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
|
|
493
|
+ <span class="k">return</span> <span class="n">data</span>
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+<span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="s1">'root'</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
|
|
497
|
+<span class="n">c</span> <span class="o">=</span> <span class="n">tcp_socket</span><span class="o">.</span><span class="n">tcp_client_stp</span><span class="p">(</span><span class="s1">'127.0.0.1'</span><span class="p">,</span> <span class="mi">17017</span><span class="p">)</span>
|
|
498
|
+<span class="n">c</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="sa">b</span><span class="s1">'abc'</span><span class="p">)</span>
|
|
499
|
+<span class="nb">print</span><span class="p">(</span><span class="s1">'The Client received: </span><span class="si">%s</span><span class="s1">'</span> <span class="o">%</span> <span class="nb">repr</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">receive</span><span class="p">()))</span>
|
|
500
|
+</pre></div>
|
|
501
|
+</div>
|
|
502
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">904</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
503
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">055</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Connection</span> <span class="n">to</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">:</span><span class="mi">17017</span> <span class="n">established</span>
|
|
504
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">056</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
505
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">105</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">TX</span> <span class="o">-></span> <span class="s2">"(7): 3a 3c 61 62 63 3a 3e"</span>
|
|
506
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">105</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">TX</span> <span class="o">-></span> <span class="s2">"(3): 61 62 63"</span>
|
|
507
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">157</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">RX</span> <span class="o"><-</span> <span class="s2">"(7): 3a 3c 61 62 63 3a 3e"</span>
|
|
508
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">157</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_IDLE</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_1</span>
|
|
509
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">157</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">start</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">c</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_1</span> <span class="o">-></span> <span class="n">STP_STATE_STORE_DATA</span>
|
|
510
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">157</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_STORE_DATA</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_2</span>
|
|
511
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">157</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">end</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">e</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">storing</span> <span class="n">message</span> <span class="ow">and</span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_2</span> <span class="o">-></span> <span class="n">STP_STATE_IDLE</span>
|
|
512
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">157</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">message</span> <span class="n">identified</span> <span class="o">-</span> <span class="p">(</span><span class="mi">3</span><span class="p">):</span> <span class="mi">61</span> <span class="mi">62</span> <span class="mi">63</span>
|
|
513
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">158</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">RX</span> <span class="o"><-</span> <span class="s2">"(3): 61 62 63"</span>
|
|
514
|
+<span class="n">The</span> <span class="n">Client</span> <span class="n">received</span><span class="p">:</span> <span class="sa">b</span><span class="s1">'abc'</span>
|
|
515
|
+</pre></div>
|
|
516
|
+</div>
|
|
517
|
+</dd></dl>
|
|
518
|
+
|
|
519
|
+<dl class="class">
|
|
520
|
+<dt id="tcp_socket.tcp_server">
|
|
521
|
+<em class="property">class </em><code class="descclassname">tcp_socket.</code><code class="descname">tcp_server</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_server" title="Permalink to this definition">¶</a></dt>
|
|
522
|
+<dd><p>This class creates a tcp-server for transfering a serial stream of bytes (characters). See also parent <a class="reference internal" href="#tcp_socket.tcp_base" title="tcp_socket.tcp_base"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_base</span></code></a>.</p>
|
|
523
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
524
|
+<col class="field-name" />
|
|
525
|
+<col class="field-body" />
|
|
526
|
+<tbody valign="top">
|
|
527
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
|
528
|
+<li><strong>host</strong> (<em>str</em>) – The host IP for the TCP socket functionality</li>
|
|
529
|
+<li><strong>port</strong> (<em>int</em>) – The port for the TCP socket functionality</li>
|
|
530
|
+<li><strong>channel_name</strong> (<em>str</em>) – The name for the logging channel</li>
|
|
531
|
+</ul>
|
|
532
|
+</td>
|
|
533
|
+</tr>
|
|
534
|
+</tbody>
|
|
535
|
+</table>
|
|
536
|
+<div class="admonition note">
|
|
537
|
+<p class="first admonition-title">Note</p>
|
|
538
|
+<p class="last">You need a <a class="reference internal" href="#tcp_socket.tcp_client" title="tcp_socket.tcp_client"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_client</span></code></a> to communicate with the server.</p>
|
|
539
|
+</div>
|
|
540
|
+<p><strong>Example:</strong></p>
|
|
541
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
|
542
|
+<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../..'</span><span class="p">)</span>
|
|
543
|
+
|
|
544
|
+<span class="kn">import</span> <span class="nn">report</span>
|
|
545
|
+<span class="kn">import</span> <span class="nn">tcp_socket</span>
|
|
546
|
+<span class="kn">import</span> <span class="nn">time</span>
|
|
547
|
+
|
|
548
|
+<span class="k">def</span> <span class="nf">mirror_callback</span><span class="p">(</span><span class="n">tcp</span><span class="p">):</span>
|
|
549
|
+ <span class="n">tcp</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">tcp</span><span class="o">.</span><span class="n">receive</span><span class="p">())</span>
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+<span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="s1">'root'</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
|
|
553
|
+<span class="n">s</span> <span class="o">=</span> <span class="n">tcp_socket</span><span class="o">.</span><span class="n">tcp_server</span><span class="p">(</span><span class="s1">'127.0.0.1'</span><span class="p">,</span> <span class="mi">17000</span><span class="p">)</span>
|
|
554
|
+<span class="n">s</span><span class="o">.</span><span class="n">register_callback</span><span class="p">(</span><span class="n">mirror_callback</span><span class="p">)</span>
|
|
555
|
+
|
|
556
|
+<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
|
|
557
|
+<span class="k">while</span> <span class="ow">not</span> <span class="n">s</span><span class="o">.</span><span class="n">is_connected</span><span class="p">()</span> <span class="ow">and</span> <span class="n">i</span> <span class="o"><=</span> <span class="mi">10</span><span class="p">:</span>
|
|
558
|
+ <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
|
|
559
|
+ <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="o">.</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># wait for a connection</span>
|
|
560
|
+
|
|
561
|
+<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
|
|
562
|
+<span class="k">while</span> <span class="n">s</span><span class="o">.</span><span class="n">is_connected</span><span class="p">()</span> <span class="ow">and</span> <span class="n">i</span> <span class="o"><=</span> <span class="mi">10</span><span class="p">:</span>
|
|
563
|
+ <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
|
|
564
|
+ <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="o">.</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># wait for disconnect</span>
|
|
565
|
+</pre></div>
|
|
566
|
+</div>
|
|
567
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">587</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
568
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">588</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Server</span> <span class="n">listening</span> <span class="n">to</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">:</span><span class="mi">17000</span>
|
|
569
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">638</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Connection</span> <span class="n">established</span><span class="o">...</span> <span class="p">(</span><span class="kn">from</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">)</span>
|
|
570
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">639</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
571
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">740</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">RX</span> <span class="o"><-</span> <span class="s2">"(3): 61 62 63"</span>
|
|
572
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">740</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
573
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">741</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">TX</span> <span class="o">-></span> <span class="s2">"(3): 61 62 63"</span>
|
|
574
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">842</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Connection</span> <span class="n">lost</span><span class="o">...</span>
|
|
575
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">05</span><span class="p">,</span><span class="mi">842</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Server</span> <span class="n">listening</span> <span class="n">to</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">:</span><span class="mi">17000</span>
|
|
576
|
+</pre></div>
|
|
577
|
+</div>
|
|
578
|
+</dd></dl>
|
|
579
|
+
|
|
580
|
+<dl class="class">
|
|
581
|
+<dt id="tcp_socket.tcp_server_stp">
|
|
582
|
+<em class="property">class </em><code class="descclassname">tcp_socket.</code><code class="descname">tcp_server_stp</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>channel_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#tcp_socket.tcp_server_stp" title="Permalink to this definition">¶</a></dt>
|
|
583
|
+<dd><p>This class creates a tcp-server for transfering a message. The bytes will be packed on send and unpacked on receive. See also parents <a class="reference internal" href="#tcp_socket.tcp_server" title="tcp_socket.tcp_server"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_server</span></code></a> and <a class="reference internal" href="#tcp_socket.tcp_base_stp" title="tcp_socket.tcp_base_stp"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_base_stp</span></code></a>.
|
|
584
|
+See <code class="xref py py-mod docutils literal notranslate"><span class="pre">stringtools.stp</span></code> for more information on packing and unpacking.</p>
|
|
585
|
+<table class="docutils field-list" frame="void" rules="none">
|
|
586
|
+<col class="field-name" />
|
|
587
|
+<col class="field-body" />
|
|
588
|
+<tbody valign="top">
|
|
589
|
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
|
590
|
+<li><strong>host</strong> (<em>str</em>) – The host IP for the TCP socket functionality</li>
|
|
591
|
+<li><strong>port</strong> (<em>int</em>) – The port for the TCP socket functionality</li>
|
|
592
|
+<li><strong>channel_name</strong> (<em>str</em>) – The name for the logging channel</li>
|
|
593
|
+</ul>
|
|
594
|
+</td>
|
|
595
|
+</tr>
|
|
596
|
+</tbody>
|
|
597
|
+</table>
|
|
598
|
+<div class="admonition note">
|
|
599
|
+<p class="first admonition-title">Note</p>
|
|
600
|
+<p class="last">You need a <a class="reference internal" href="#tcp_socket.tcp_client_stp" title="tcp_socket.tcp_client_stp"><code class="xref py py-class docutils literal notranslate"><span class="pre">tcp_client_stp</span></code></a> to communicate with the server.</p>
|
|
601
|
+</div>
|
|
602
|
+<p><strong>Example:</strong></p>
|
|
603
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
|
604
|
+<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../..'</span><span class="p">)</span>
|
|
605
|
+
|
|
606
|
+<span class="kn">import</span> <span class="nn">report</span>
|
|
607
|
+<span class="kn">import</span> <span class="nn">tcp_socket</span>
|
|
608
|
+<span class="kn">import</span> <span class="nn">time</span>
|
|
609
|
+
|
|
610
|
+<span class="k">def</span> <span class="nf">mirror_callback</span><span class="p">(</span><span class="n">tcp</span><span class="p">):</span>
|
|
611
|
+ <span class="n">tcp</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">tcp</span><span class="o">.</span><span class="n">receive</span><span class="p">())</span>
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+<span class="n">report</span><span class="o">.</span><span class="n">stdoutLoggingConfigure</span><span class="p">(</span><span class="n">log_name_lvl</span><span class="o">=</span><span class="p">[(</span><span class="s1">'root'</span><span class="p">,</span> <span class="s1">'DEBUG'</span><span class="p">),</span> <span class="p">])</span>
|
|
615
|
+<span class="n">s</span> <span class="o">=</span> <span class="n">tcp_socket</span><span class="o">.</span><span class="n">tcp_server_stp</span><span class="p">(</span><span class="s1">'127.0.0.1'</span><span class="p">,</span> <span class="mi">17017</span><span class="p">)</span>
|
|
616
|
+<span class="n">s</span><span class="o">.</span><span class="n">register_callback</span><span class="p">(</span><span class="n">mirror_callback</span><span class="p">)</span>
|
|
617
|
+
|
|
618
|
+<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
|
|
619
|
+<span class="k">while</span> <span class="ow">not</span> <span class="n">s</span><span class="o">.</span><span class="n">is_connected</span><span class="p">()</span> <span class="ow">and</span> <span class="n">i</span> <span class="o"><=</span> <span class="mi">10</span><span class="p">:</span>
|
|
620
|
+ <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
|
|
621
|
+ <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="o">.</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># wait for a connection</span>
|
|
622
|
+
|
|
623
|
+<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
|
|
624
|
+<span class="k">while</span> <span class="n">s</span><span class="o">.</span><span class="n">is_connected</span><span class="p">()</span> <span class="ow">and</span> <span class="n">i</span> <span class="o"><=</span> <span class="mi">10</span><span class="p">:</span>
|
|
625
|
+ <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
|
|
626
|
+ <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="o">.</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># wait for disconnect</span>
|
|
627
|
+</pre></div>
|
|
628
|
+</div>
|
|
629
|
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">713</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
630
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">713</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Server</span> <span class="n">listening</span> <span class="n">to</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">:</span><span class="mi">17017</span>
|
|
631
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">814</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Connection</span> <span class="n">established</span><span class="o">...</span> <span class="p">(</span><span class="kn">from</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">)</span>
|
|
632
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">815</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Cleaning</span> <span class="n">up</span> <span class="n">receive</span><span class="o">-</span><span class="n">buffer</span>
|
|
633
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">916</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">RX</span> <span class="o"><-</span> <span class="s2">"(7): 3a 3c 61 62 63 3a 3e"</span>
|
|
634
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">916</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_IDLE</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_1</span>
|
|
635
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">916</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">start</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">c</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_1</span> <span class="o">-></span> <span class="n">STP_STATE_STORE_DATA</span>
|
|
636
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">916</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">data</span> <span class="n">sync</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_STORE_DATA</span> <span class="o">-></span> <span class="n">STP_STATE_ESCAPE_2</span>
|
|
637
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">916</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">end</span> <span class="n">pattern</span> <span class="p">(</span><span class="mi">3</span><span class="n">a</span> <span class="mi">3</span><span class="n">e</span><span class="p">)</span> <span class="n">received</span> <span class="o">=></span> <span class="n">storing</span> <span class="n">message</span> <span class="ow">and</span> <span class="n">changing</span> <span class="n">state</span> <span class="n">STP_STATE_ESCAPE_2</span> <span class="o">-></span> <span class="n">STP_STATE_IDLE</span>
|
|
638
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">917</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">stringtools</span><span class="o">.</span><span class="n">stp</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">STP</span><span class="p">:</span> <span class="n">message</span> <span class="n">identified</span> <span class="o">-</span> <span class="p">(</span><span class="mi">3</span><span class="p">):</span> <span class="mi">61</span> <span class="mi">62</span> <span class="mi">63</span>
|
|
639
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">917</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">RX</span> <span class="o"><-</span> <span class="s2">"(3): 61 62 63"</span>
|
|
640
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">917</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">DEBUG</span> <span class="o">-</span> <span class="n">TX</span> <span class="o">-></span> <span class="s2">"(7): 3a 3c 61 62 63 3a 3e"</span>
|
|
641
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">06</span><span class="p">,</span><span class="mi">917</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">TX</span> <span class="o">-></span> <span class="s2">"(3): 61 62 63"</span>
|
|
642
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">07</span><span class="p">,</span><span class="mi">069</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Connection</span> <span class="n">lost</span><span class="o">...</span>
|
|
643
|
+<span class="mi">2021</span><span class="o">-</span><span class="mi">01</span><span class="o">-</span><span class="mi">08</span> <span class="mi">02</span><span class="p">:</span><span class="mi">31</span><span class="p">:</span><span class="mi">07</span><span class="p">,</span><span class="mi">069</span><span class="p">:</span> <span class="n">root</span><span class="o">.</span><span class="n">tcp_socket</span><span class="o">.</span><span class="n">all_others</span> <span class="o">-</span> <span class="n">INFO</span> <span class="o">-</span> <span class="n">Server</span> <span class="n">listening</span> <span class="n">to</span> <span class="mf">127.0</span><span class="o">.</span><span class="mf">0.1</span><span class="p">:</span><span class="mi">17017</span>
|
|
644
|
+</pre></div>
|
|
645
|
+</div>
|
|
646
|
+</dd></dl>
|
|
647
|
+
|
|
648
|
+</div>
|
|
649
|
+<div class="toctree-wrapper compound">
|
|
650
|
+</div>
|
|
651
|
+</div>
|
|
652
|
+<div class="section" id="indices-and-tables">
|
|
653
|
+<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
|
|
654
|
+<ul class="simple">
|
|
655
|
+<li><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></li>
|
|
656
|
+<li><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></li>
|
|
657
|
+<li><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></li>
|
|
658
|
+</ul>
|
|
659
|
+</div>
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+ </div>
|
|
663
|
+
|
|
664
|
+ </div>
|
|
665
|
+ <footer>
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+ <hr/>
|
|
669
|
+
|
|
670
|
+ <div role="contentinfo">
|
|
671
|
+ <p>
|
|
672
|
+
|
|
673
|
+ © Copyright 2021, Dirk Alders
|
|
674
|
+
|
|
675
|
+ </p>
|
|
676
|
+ </div>
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+ Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
|
|
681
|
+
|
|
682
|
+ <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
|
|
683
|
+
|
|
684
|
+ provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
685
|
+
|
|
686
|
+</footer>
|
|
687
|
+
|
|
688
|
+ </div>
|
|
689
|
+ </div>
|
|
690
|
+
|
|
691
|
+ </section>
|
|
692
|
+
|
|
693
|
+ </div>
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+ <script type="text/javascript">
|
|
697
|
+ jQuery(function () {
|
|
698
|
+ SphinxRtdTheme.Navigation.enable(true);
|
|
699
|
+ });
|
|
700
|
+ </script>
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+</body>
|
|
708
|
+</html>
|