maxcube-client 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/.rubocop.yml +0 -3
  4. data/.yardopts +1 -0
  5. data/README.md +17 -2
  6. data/bin/maxcube-client +2 -27
  7. data/doc/MaxCube.html +502 -0
  8. data/doc/MaxCube/Messages.html +1927 -0
  9. data/doc/MaxCube/Messages/Handler.html +2912 -0
  10. data/doc/MaxCube/Messages/InvalidMessage.html +140 -0
  11. data/doc/MaxCube/Messages/InvalidMessageBody.html +264 -0
  12. data/doc/MaxCube/Messages/InvalidMessageFormat.html +247 -0
  13. data/doc/MaxCube/Messages/InvalidMessageLength.html +247 -0
  14. data/doc/MaxCube/Messages/InvalidMessageType.html +263 -0
  15. data/doc/MaxCube/Messages/Parser.html +520 -0
  16. data/doc/MaxCube/Messages/Serializer.html +701 -0
  17. data/doc/MaxCube/Messages/TCP.html +172 -0
  18. data/doc/MaxCube/Messages/TCP/Handler.html +1396 -0
  19. data/doc/MaxCube/Messages/TCP/Parser.html +462 -0
  20. data/doc/MaxCube/Messages/TCP/Parser/MessageA.html +186 -0
  21. data/doc/MaxCube/Messages/TCP/Parser/MessageC.html +1077 -0
  22. data/doc/MaxCube/Messages/TCP/Parser/MessageF.html +206 -0
  23. data/doc/MaxCube/Messages/TCP/Parser/MessageH.html +338 -0
  24. data/doc/MaxCube/Messages/TCP/Parser/MessageL.html +535 -0
  25. data/doc/MaxCube/Messages/TCP/Parser/MessageM.html +510 -0
  26. data/doc/MaxCube/Messages/TCP/Parser/MessageN.html +226 -0
  27. data/doc/MaxCube/Messages/TCP/Parser/MessageS.html +225 -0
  28. data/doc/MaxCube/Messages/TCP/Serializer.html +460 -0
  29. data/doc/MaxCube/Messages/TCP/Serializer/MessageA.html +186 -0
  30. data/doc/MaxCube/Messages/TCP/Serializer/MessageC.html +185 -0
  31. data/doc/MaxCube/Messages/TCP/Serializer/MessageF.html +206 -0
  32. data/doc/MaxCube/Messages/TCP/Serializer/MessageL.html +185 -0
  33. data/doc/MaxCube/Messages/TCP/Serializer/MessageM.html +428 -0
  34. data/doc/MaxCube/Messages/TCP/Serializer/MessageN.html +209 -0
  35. data/doc/MaxCube/Messages/TCP/Serializer/MessageQ.html +185 -0
  36. data/doc/MaxCube/Messages/TCP/Serializer/MessageS.html +1168 -0
  37. data/doc/MaxCube/Messages/TCP/Serializer/MessageT.html +240 -0
  38. data/doc/MaxCube/Messages/TCP/Serializer/MessageU.html +206 -0
  39. data/doc/MaxCube/Messages/TCP/Serializer/MessageZ.html +252 -0
  40. data/doc/MaxCube/Messages/UDP.html +164 -0
  41. data/doc/MaxCube/Messages/UDP/Handler.html +832 -0
  42. data/doc/MaxCube/Messages/UDP/Parser.html +609 -0
  43. data/doc/MaxCube/Messages/UDP/Parser/MessageH.html +218 -0
  44. data/doc/MaxCube/Messages/UDP/Parser/MessageI.html +215 -0
  45. data/doc/MaxCube/Messages/UDP/Parser/MessageN.html +226 -0
  46. data/doc/MaxCube/Messages/UDP/Serializer.html +484 -0
  47. data/doc/MaxCube/Network.html +167 -0
  48. data/doc/MaxCube/Network/TCP.html +150 -0
  49. data/doc/MaxCube/Network/TCP/Client.html +1930 -0
  50. data/doc/MaxCube/Network/TCP/Client/Commands.html +2457 -0
  51. data/doc/MaxCube/Network/TCP/SampleServer.html +910 -0
  52. data/doc/MaxCube/Network/UDP.html +150 -0
  53. data/doc/MaxCube/Network/UDP/Client.html +518 -0
  54. data/doc/MaxCube/Network/UDP/SampleSocket.html +628 -0
  55. data/doc/MaxCube/Runner.html +355 -0
  56. data/doc/_index.html +518 -0
  57. data/doc/class_list.html +51 -0
  58. data/doc/css/common.css +1 -0
  59. data/doc/css/full_list.css +58 -0
  60. data/doc/css/style.css +499 -0
  61. data/doc/file.README.html +140 -0
  62. data/doc/file_list.html +56 -0
  63. data/doc/frames.html +17 -0
  64. data/doc/index.html +140 -0
  65. data/doc/js/app.js +248 -0
  66. data/doc/js/full_list.js +216 -0
  67. data/doc/js/jquery.js +4 -0
  68. data/doc/method_list.html +1699 -0
  69. data/doc/top-level-namespace.html +110 -0
  70. data/lib/maxcube.rb +11 -0
  71. data/lib/maxcube/messages.rb +85 -8
  72. data/lib/maxcube/messages/handler.rb +138 -4
  73. data/lib/maxcube/messages/parser.rb +33 -2
  74. data/lib/maxcube/messages/serializer.rb +64 -16
  75. data/lib/maxcube/messages/tcp.rb +11 -7
  76. data/lib/maxcube/messages/tcp/handler.rb +50 -2
  77. data/lib/maxcube/messages/tcp/parser.rb +18 -17
  78. data/lib/maxcube/messages/tcp/serializer.rb +20 -21
  79. data/lib/maxcube/messages/tcp/type/a.rb +6 -6
  80. data/lib/maxcube/messages/tcp/type/c.rb +5 -3
  81. data/lib/maxcube/messages/tcp/type/f.rb +5 -3
  82. data/lib/maxcube/messages/tcp/type/h.rb +3 -2
  83. data/lib/maxcube/messages/tcp/type/l.rb +8 -7
  84. data/lib/maxcube/messages/tcp/type/m.rb +11 -7
  85. data/lib/maxcube/messages/tcp/type/n.rb +5 -3
  86. data/lib/maxcube/messages/tcp/type/q.rb +2 -2
  87. data/lib/maxcube/messages/tcp/type/s.rb +5 -2
  88. data/lib/maxcube/messages/tcp/type/t.rb +5 -4
  89. data/lib/maxcube/messages/tcp/type/u.rb +2 -1
  90. data/lib/maxcube/messages/tcp/type/z.rb +4 -2
  91. data/lib/maxcube/messages/udp.rb +7 -0
  92. data/lib/maxcube/messages/udp/handler.rb +28 -0
  93. data/lib/maxcube/messages/udp/parser.rb +23 -6
  94. data/lib/maxcube/messages/udp/serializer.rb +17 -1
  95. data/lib/maxcube/messages/udp/type/h.rb +2 -0
  96. data/lib/maxcube/messages/udp/type/i.rb +3 -0
  97. data/lib/maxcube/messages/udp/type/n.rb +3 -0
  98. data/lib/maxcube/network.rb +5 -1
  99. data/lib/maxcube/network/tcp.rb +3 -0
  100. data/lib/maxcube/network/tcp/client.rb +117 -3
  101. data/lib/maxcube/network/tcp/client/commands.rb +306 -239
  102. data/lib/maxcube/network/tcp/sample_server.rb +1 -0
  103. data/lib/maxcube/network/udp.rb +3 -0
  104. data/lib/maxcube/network/udp/client.rb +2 -0
  105. data/lib/maxcube/network/udp/sample_socket.rb +1 -0
  106. data/lib/maxcube/runner.rb +45 -0
  107. data/lib/maxcube/version.rb +2 -1
  108. data/maxcube-client.gemspec +2 -0
  109. metadata +84 -3
@@ -0,0 +1,628 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: MaxCube::Network::UDP::SampleSocket
8
+
9
+ &mdash; Documentation by YARD 0.9.12
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "MaxCube::Network::UDP::SampleSocket";
19
+ relpath = '../../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../../MaxCube.html" title="MaxCube (module)">MaxCube</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Network.html" title="MaxCube::Network (module)">Network</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../UDP.html" title="MaxCube::Network::UDP (module)">UDP</a></span></span>
41
+ &raquo;
42
+ <span class="title">SampleSocket</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: MaxCube::Network::UDP::SampleSocket
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">MaxCube::Network::UDP::SampleSocket</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/maxcube/network/udp/sample_socket.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Simple UDP &#39;server&#39; for Cube protocol testing purposes.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ <h2>
122
+ Instance Method Summary
123
+ <small><a href="#" class="summary_toggle">collapse</a></small>
124
+ </h2>
125
+
126
+ <ul class="summary">
127
+
128
+ <li class="private ">
129
+ <span class="summary_signature">
130
+
131
+ <a href="#close-instance_method" title="#close (instance method)">#<strong>close</strong> &#x21d2; Object </a>
132
+
133
+
134
+
135
+ </span>
136
+
137
+
138
+
139
+ <span class="note title private">private</span>
140
+
141
+
142
+
143
+
144
+
145
+ <span class="summary_desc"><div class='inline'></div></span>
146
+
147
+ </li>
148
+
149
+
150
+ <li class="private ">
151
+ <span class="summary_signature">
152
+
153
+ <a href="#cmd-instance_method" title="#cmd (instance method)">#<strong>cmd</strong>(msg, addr, port) &#x21d2; Object </a>
154
+
155
+
156
+
157
+ </span>
158
+
159
+
160
+
161
+ <span class="note title private">private</span>
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'></div></span>
168
+
169
+ </li>
170
+
171
+
172
+ <li class="public ">
173
+ <span class="summary_signature">
174
+
175
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(port = PORT) &#x21d2; SampleSocket </a>
176
+
177
+
178
+
179
+ </span>
180
+
181
+
182
+ <span class="note title constructor">constructor</span>
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ <span class="summary_desc"><div class='inline'>
192
+ <p>A new instance of SampleSocket.</p>
193
+ </div></span>
194
+
195
+ </li>
196
+
197
+
198
+ <li class="private ">
199
+ <span class="summary_signature">
200
+
201
+ <a href="#msg_h-instance_method" title="#msg_h (instance method)">#<strong>msg_h</strong> &#x21d2; Object </a>
202
+
203
+
204
+
205
+ </span>
206
+
207
+
208
+
209
+ <span class="note title private">private</span>
210
+
211
+
212
+
213
+
214
+
215
+ <span class="summary_desc"><div class='inline'></div></span>
216
+
217
+ </li>
218
+
219
+
220
+ <li class="private ">
221
+ <span class="summary_signature">
222
+
223
+ <a href="#msg_i-instance_method" title="#msg_i (instance method)">#<strong>msg_i</strong> &#x21d2; Object </a>
224
+
225
+
226
+
227
+ </span>
228
+
229
+
230
+
231
+ <span class="note title private">private</span>
232
+
233
+
234
+
235
+
236
+
237
+ <span class="summary_desc"><div class='inline'></div></span>
238
+
239
+ </li>
240
+
241
+
242
+ <li class="private ">
243
+ <span class="summary_signature">
244
+
245
+ <a href="#msg_n-instance_method" title="#msg_n (instance method)">#<strong>msg_n</strong> &#x21d2; Object </a>
246
+
247
+
248
+
249
+ </span>
250
+
251
+
252
+
253
+ <span class="note title private">private</span>
254
+
255
+
256
+
257
+
258
+
259
+ <span class="summary_desc"><div class='inline'></div></span>
260
+
261
+ </li>
262
+
263
+
264
+ <li class="public ">
265
+ <span class="summary_signature">
266
+
267
+ <a href="#run-instance_method" title="#run (instance method)">#<strong>run</strong> &#x21d2; Object </a>
268
+
269
+
270
+
271
+ </span>
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+ <span class="summary_desc"><div class='inline'></div></span>
282
+
283
+ </li>
284
+
285
+
286
+ <li class="public ">
287
+ <span class="summary_signature">
288
+
289
+ <a href="#send_msg-instance_method" title="#send_msg (instance method)">#<strong>send_msg</strong>(msg, addr, port) &#x21d2; Object </a>
290
+
291
+
292
+
293
+ </span>
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+ <span class="summary_desc"><div class='inline'></div></span>
304
+
305
+ </li>
306
+
307
+
308
+ </ul>
309
+
310
+
311
+ <div id="constructor_details" class="method_details_list">
312
+ <h2>Constructor Details</h2>
313
+
314
+ <div class="method_details first">
315
+ <h3 class="signature first" id="initialize-instance_method">
316
+
317
+ #<strong>initialize</strong>(port = PORT) &#x21d2; <tt><span class='object_link'><a href="" title="MaxCube::Network::UDP::SampleSocket (class)">SampleSocket</a></span></tt>
318
+
319
+
320
+
321
+
322
+
323
+ </h3><div class="docstring">
324
+ <div class="discussion">
325
+
326
+ <p>Returns a new instance of SampleSocket</p>
327
+
328
+
329
+ </div>
330
+ </div>
331
+ <div class="tags">
332
+
333
+
334
+ </div><table class="source_code">
335
+ <tr>
336
+ <td>
337
+ <pre class="lines">
338
+
339
+
340
+ 8
341
+ 9
342
+ 10
343
+ 11
344
+ 12
345
+ 13
346
+ 14
347
+ 15</pre>
348
+ </td>
349
+ <td>
350
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 8</span>
351
+
352
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_port'>port</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../UDP.html#PORT-constant" title="MaxCube::Network::UDP::PORT (constant)">PORT</a></span></span><span class='rparen'>)</span>
353
+ <span class='ivar'>@port</span> <span class='op'>=</span> <span class='id identifier rubyid_port'>port</span>
354
+ <span class='ivar'>@socket</span> <span class='op'>=</span> <span class='const'>UDPSocket</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
355
+ <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_bind'>bind</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.0.0.0</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
356
+
357
+ <span class='ivar'>@parser</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Messages.html" title="MaxCube::Messages (module)">Messages</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Messages/UDP.html" title="MaxCube::Messages::UDP (module)">UDP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Messages/UDP/Parser.html" title="MaxCube::Messages::UDP::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
358
+ <span class='ivar'>@serializer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Messages.html" title="MaxCube::Messages (module)">Messages</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Messages/UDP.html" title="MaxCube::Messages::UDP (module)">UDP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Messages/UDP/Serializer.html" title="MaxCube::Messages::UDP::Serializer (class)">Serializer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
359
+ <span class='kw'>end</span></pre>
360
+ </td>
361
+ </tr>
362
+ </table>
363
+ </div>
364
+
365
+ </div>
366
+
367
+
368
+ <div id="instance_method_details" class="method_details_list">
369
+ <h2>Instance Method Details</h2>
370
+
371
+
372
+ <div class="method_details first">
373
+ <h3 class="signature first" id="close-instance_method">
374
+
375
+ #<strong>close</strong> &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
376
+
377
+
378
+
379
+
380
+
381
+ </h3><table class="source_code">
382
+ <tr>
383
+ <td>
384
+ <pre class="lines">
385
+
386
+
387
+ 59
388
+ 60
389
+ 61
390
+ 62</pre>
391
+ </td>
392
+ <td>
393
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 59</span>
394
+
395
+ <span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
396
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\nClosing socket ...</span><span class='tstring_end'>&quot;</span></span>
397
+ <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
398
+ <span class='kw'>end</span></pre>
399
+ </td>
400
+ </tr>
401
+ </table>
402
+ </div>
403
+
404
+ <div class="method_details ">
405
+ <h3 class="signature " id="cmd-instance_method">
406
+
407
+ #<strong>cmd</strong>(msg, addr, port) &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
408
+
409
+
410
+
411
+
412
+
413
+ </h3><table class="source_code">
414
+ <tr>
415
+ <td>
416
+ <pre class="lines">
417
+
418
+
419
+ 36
420
+ 37
421
+ 38
422
+ 39
423
+ 40
424
+ 41
425
+ 42
426
+ 43</pre>
427
+ </td>
428
+ <td>
429
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 36</span>
430
+
431
+ <span class='kw'>def</span> <span class='id identifier rubyid_cmd'>cmd</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='id identifier rubyid_addr'>addr</span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
432
+ <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='ivar'>@serializer</span><span class='period'>.</span><span class='id identifier rubyid_check_msg_msg_type'>check_msg_msg_type</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
433
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Message type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
434
+
435
+ <span class='id identifier rubyid_method_str'>method_str</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>msg_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
436
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method_str'>method_str</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
437
+ <span class='id identifier rubyid_send_msg'>send_msg</span><span class='lparen'>(</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method_str'>method_str</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_addr'>addr</span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
438
+ <span class='kw'>end</span></pre>
439
+ </td>
440
+ </tr>
441
+ </table>
442
+ </div>
443
+
444
+ <div class="method_details ">
445
+ <h3 class="signature " id="msg_h-instance_method">
446
+
447
+ #<strong>msg_h</strong> &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
448
+
449
+
450
+
451
+
452
+
453
+ </h3><table class="source_code">
454
+ <tr>
455
+ <td>
456
+ <pre class="lines">
457
+
458
+
459
+ 55
460
+ 56
461
+ 57</pre>
462
+ </td>
463
+ <td>
464
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 55</span>
465
+
466
+ <span class='kw'>def</span> <span class='id identifier rubyid_msg_h'>msg_h</span>
467
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>eQ3MaxApKEQ0565026&gt;h\x00Pmax.eq-3.de,/cube</span><span class='tstring_end'>&quot;</span></span>
468
+ <span class='kw'>end</span></pre>
469
+ </td>
470
+ </tr>
471
+ </table>
472
+ </div>
473
+
474
+ <div class="method_details ">
475
+ <h3 class="signature " id="msg_i-instance_method">
476
+
477
+ #<strong>msg_i</strong> &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
478
+
479
+
480
+
481
+
482
+
483
+ </h3><table class="source_code">
484
+ <tr>
485
+ <td>
486
+ <pre class="lines">
487
+
488
+
489
+ 45
490
+ 46
491
+ 47</pre>
492
+ </td>
493
+ <td>
494
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 45</span>
495
+
496
+ <span class='kw'>def</span> <span class='id identifier rubyid_msg_i'>msg_i</span>
497
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>eQ3MaxApKEQ0523864&gt;I\x00\x09\x7f\x2c\x01\x13</span><span class='tstring_end'>&quot;</span></span>
498
+ <span class='kw'>end</span></pre>
499
+ </td>
500
+ </tr>
501
+ </table>
502
+ </div>
503
+
504
+ <div class="method_details ">
505
+ <h3 class="signature " id="msg_n-instance_method">
506
+
507
+ #<strong>msg_n</strong> &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
508
+
509
+
510
+
511
+
512
+
513
+ </h3><table class="source_code">
514
+ <tr>
515
+ <td>
516
+ <pre class="lines">
517
+
518
+
519
+ 49
520
+ 50
521
+ 51
522
+ 52
523
+ 53</pre>
524
+ </td>
525
+ <td>
526
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 49</span>
527
+
528
+ <span class='kw'>def</span> <span class='id identifier rubyid_msg_n'>msg_n</span>
529
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>eQ3MaxApKEQ0565026&gt;N</span><span class='tstring_end'>&#39;</span></span> \
530
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\xc0\xa8\x00\xde\xc0\xa8\x00\x01\xff\xff\x00\x00</span><span class='tstring_end'>&quot;</span></span> \
531
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\xc0\xa8\x00\x01\xc0\xa8\x00\x01</span><span class='tstring_end'>&quot;</span></span>
532
+ <span class='kw'>end</span></pre>
533
+ </td>
534
+ </tr>
535
+ </table>
536
+ </div>
537
+
538
+ <div class="method_details ">
539
+ <h3 class="signature " id="run-instance_method">
540
+
541
+ #<strong>run</strong> &#x21d2; <tt>Object</tt>
542
+
543
+
544
+
545
+
546
+
547
+ </h3><table class="source_code">
548
+ <tr>
549
+ <td>
550
+ <pre class="lines">
551
+
552
+
553
+ 17
554
+ 18
555
+ 19
556
+ 20
557
+ 21
558
+ 22
559
+ 23
560
+ 24
561
+ 25
562
+ 26
563
+ 27
564
+ 28</pre>
565
+ </td>
566
+ <td>
567
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 17</span>
568
+
569
+ <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
570
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Starting socket on port </span><span class='embexpr_beg'>#{</span><span class='ivar'>@port</span><span class='embexpr_end'>}</span><span class='tstring_content'> ...\n\n</span><span class='tstring_end'>&quot;</span></span>
571
+ <span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span>
572
+ <span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='id identifier rubyid_addr'>addr</span> <span class='op'>=</span> <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_recvfrom'>recvfrom</span><span class='lparen'>(</span><span class='int'>1024</span><span class='rparen'>)</span>
573
+ <span class='id identifier rubyid_port'>port</span> <span class='op'>=</span> <span class='id identifier rubyid_addr'>addr</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
574
+ <span class='id identifier rubyid_ipaddr'>ipaddr</span> <span class='op'>=</span> <span class='id identifier rubyid_addr'>addr</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span>
575
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Income message from </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ipaddr'>ipaddr</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_port'>port</span><span class='embexpr_end'>}</span><span class='tstring_content'>: &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_msg'>msg</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;</span><span class='tstring_end'>&quot;</span></span>
576
+ <span class='id identifier rubyid_cmd'>cmd</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='id identifier rubyid_ipaddr'>ipaddr</span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@serializer</span><span class='period'>.</span><span class='id identifier rubyid_valid_udp_msg'>valid_udp_msg</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
577
+ <span class='kw'>end</span>
578
+ <span class='kw'>rescue</span> <span class='const'>Interrupt</span>
579
+ <span class='id identifier rubyid_close'>close</span>
580
+ <span class='kw'>end</span></pre>
581
+ </td>
582
+ </tr>
583
+ </table>
584
+ </div>
585
+
586
+ <div class="method_details ">
587
+ <h3 class="signature " id="send_msg-instance_method">
588
+
589
+ #<strong>send_msg</strong>(msg, addr, port) &#x21d2; <tt>Object</tt>
590
+
591
+
592
+
593
+
594
+
595
+ </h3><table class="source_code">
596
+ <tr>
597
+ <td>
598
+ <pre class="lines">
599
+
600
+
601
+ 30
602
+ 31
603
+ 32</pre>
604
+ </td>
605
+ <td>
606
+ <pre class="code"><span class="info file"># File 'lib/maxcube/network/udp/sample_socket.rb', line 30</span>
607
+
608
+ <span class='kw'>def</span> <span class='id identifier rubyid_send_msg'>send_msg</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='id identifier rubyid_addr'>addr</span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
609
+ <span class='ivar'>@socket</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_addr'>addr</span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
610
+ <span class='kw'>end</span></pre>
611
+ </td>
612
+ </tr>
613
+ </table>
614
+ </div>
615
+
616
+ </div>
617
+
618
+ </div>
619
+
620
+ <div id="footer">
621
+ Generated on Fri Feb 16 13:44:02 2018 by
622
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
623
+ 0.9.12 (ruby-2.5.0).
624
+ </div>
625
+
626
+ </div>
627
+ </body>
628
+ </html>