This file is indexed.

/usr/share/doc/python-pyevolve-doc/html/module_network.html is in python-pyevolve-doc 0.6~rc1+svn398+dfsg-9.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Network – network utility module &mdash; Pyevolve 0.6 final documentation</title>
    
    <link rel="stylesheet" href="_static/default_patch.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.6 final',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Pyevolve 0.6 final documentation" href="index.html" />
    <link rel="up" title="pyevolve – the main pyevolve namespace" href="module_pyevolve.html" />
    <link rel="next" title="Migration – the migration schemes, distributed GA" href="module_migration.html" />
    <link rel="prev" title="Util – utility module" href="module_util.html" />

  </head>
  <body role="document">  

    <div class="document">

      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <span class="target" id="module-Network"></span><div class="section" id="network-network-utility-module">
<h1><a class="reference internal" href="#module-Network" title="Network"><code class="xref py py-mod docutils literal"><span class="pre">Network</span></code></a> &#8211; network utility module<a class="headerlink" href="#network-network-utility-module" title="Permalink to this headline"></a></h1>
<p>In this module you&#8217;ll find all the network related implementation</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6: </span>The <em>Network</em> module.</p>
</div>
<dl class="class">
<dt id="Network.UDPThreadBroadcastClient">
<em class="property">class </em><code class="descclassname">Network.</code><code class="descname">UDPThreadBroadcastClient</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>target_port</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient" title="Permalink to this definition"></a></dt>
<dd><p>The Broadcast UDP client thread class.</p>
<p>This class is a thread to serve as Pyevolve client on the UDP
datagrams, it is used to send data over network lan/wan.</p>
<dl class="docutils">
<dt>Example:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">Network</span><span class="o">.</span><span class="n">UDPThreadClient</span><span class="p">(</span><span class="s1">&#39;192.168.0.2&#39;</span><span class="p">,</span> <span class="mi">1500</span><span class="p">,</span> <span class="mi">666</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">setData</span><span class="p">(</span><span class="s2">&quot;Test data&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">join</span><span class="p">()</span>
</pre></div>
</div>
</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>host</strong> &#8211; the hostname to bind the socket on sender (this is NOT the target host)</li>
<li><strong>port</strong> &#8211; the sender port (this is NOT the target port)</li>
<li><strong>target_port</strong> &#8211; the destination port target</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the internal socket</p>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadBroadcastClient.daemon">
<code class="descname">daemon</code><a class="headerlink" href="#Network.UDPThreadBroadcastClient.daemon" title="Permalink to this definition"></a></dt>
<dd><p>A boolean value indicating whether this thread is a daemon thread (True) or not (False).</p>
<p>This must be set before start() is called, otherwise RuntimeError is
raised. Its initial value is inherited from the creating thread; the
main thread is not a daemon thread and therefore all threads created in
the main thread default to daemon = False.</p>
<p>The entire Python program exits when no alive non-daemon threads are
left.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.getData">
<code class="descname">getData</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.getData" title="Permalink to this definition"></a></dt>
<dd><p>Get the data to send</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">data to send</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.getSentBytes">
<code class="descname">getSentBytes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.getSentBytes" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of sent bytes. The use of this method makes sense 
when you already have sent the data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">sent bytes</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadBroadcastClient.ident">
<code class="descname">ident</code><a class="headerlink" href="#Network.UDPThreadBroadcastClient.ident" title="Permalink to this definition"></a></dt>
<dd><p>Thread identifier of this thread or None if it has not been started.</p>
<p>This is a nonzero integer. See the thread.get_ident() function. Thread
identifiers may be recycled when a thread exits and another thread is
created. The identifier is available even after the thread has exited.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.isAlive">
<code class="descname">isAlive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.isAlive" title="Permalink to this definition"></a></dt>
<dd><p>Return whether the thread is alive.</p>
<p>This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.is_alive">
<code class="descname">is_alive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.is_alive" title="Permalink to this definition"></a></dt>
<dd><p>Return whether the thread is alive.</p>
<p>This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.join">
<code class="descname">join</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.join" title="Permalink to this definition"></a></dt>
<dd><p>Wait until the thread terminates.</p>
<p>This blocks the calling thread until the thread whose join() method is
called terminates &#8211; either normally or through an unhandled exception
or until the optional timeout occurs.</p>
<p>When the timeout argument is present and not None, it should be a
floating point number specifying a timeout for the operation in seconds
(or fractions thereof). As join() always returns None, you must call
isAlive() after join() to decide whether a timeout happened &#8211; if the
thread is still alive, the join() call timed out.</p>
<p>When the timeout argument is not present or None, the operation will
block until the thread terminates.</p>
<p>A thread can be join()ed many times.</p>
<p>join() raises a RuntimeError if an attempt is made to join the current
thread as that would cause a deadlock. It is also an error to join() a
thread before it has been started and attempts to do so raises the same
exception.</p>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadBroadcastClient.name">
<code class="descname">name</code><a class="headerlink" href="#Network.UDPThreadBroadcastClient.name" title="Permalink to this definition"></a></dt>
<dd><p>A string used for identification purposes only.</p>
<p>It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.run">
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.run" title="Permalink to this definition"></a></dt>
<dd><p>Method called when you call <em>.start()</em> of the thread</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.send">
<code class="descname">send</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.send" title="Permalink to this definition"></a></dt>
<dd><p>Broadcasts the data</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.setData">
<code class="descname">setData</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.setData" title="Permalink to this definition"></a></dt>
<dd><p>Set the data to send</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> &#8211; the data to send</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadBroadcastClient.start">
<code class="descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadBroadcastClient.start" title="Permalink to this definition"></a></dt>
<dd><p>Start the thread&#8217;s activity.</p>
<p>It must be called at most once per thread object. It arranges for the
object&#8217;s run() method to be invoked in a separate thread of control.</p>
<p>This method will raise a RuntimeError if called more than once on the
same thread object.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Network.UDPThreadServer">
<em class="property">class </em><code class="descclassname">Network.</code><code class="descname">UDPThreadServer</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>poolSize=10</em>, <em>timeout=3</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer" title="Permalink to this definition"></a></dt>
<dd><p>The UDP server thread class.</p>
<p>This class is a thread to serve as Pyevolve server on the UDP
datagrams, it is used to receive data from network lan/wan.</p>
<dl class="docutils">
<dt>Example:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">UDPThreadServer</span><span class="p">(</span><span class="s2">&quot;192.168.0.2&quot;</span><span class="p">,</span> <span class="mi">666</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">shutdown</span><span class="p">()</span>
</pre></div>
</div>
</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>host</strong> &#8211; the host to bind the server</li>
<li><strong>port</strong> &#8211; the server port to bind</li>
<li><strong>poolSize</strong> &#8211; the size of the server pool</li>
<li><strong>timeout</strong> &#8211; the socket timeout</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">this thread implements a pool to keep the received data,
the <em>poolSize</em> parameter specifies how much individuals
we must keep on the pool until the <em>popPool</em> method 
is called; when the pool is full, the sever will
discard the received individuals.</p>
</div>
<dl class="method">
<dt id="Network.UDPThreadServer.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.close" title="Permalink to this definition"></a></dt>
<dd><p>Closes the internal socket</p>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadServer.daemon">
<code class="descname">daemon</code><a class="headerlink" href="#Network.UDPThreadServer.daemon" title="Permalink to this definition"></a></dt>
<dd><p>A boolean value indicating whether this thread is a daemon thread (True) or not (False).</p>
<p>This must be set before start() is called, otherwise RuntimeError is
raised. Its initial value is inherited from the creating thread; the
main thread is not a daemon thread and therefore all threads created in
the main thread default to daemon = False.</p>
<p>The entire Python program exits when no alive non-daemon threads are
left.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.getBufferSize">
<code class="descname">getBufferSize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.getBufferSize" title="Permalink to this definition"></a></dt>
<dd><p>Gets the current receive buffer size</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">integer</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.getData">
<code class="descname">getData</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.getData" title="Permalink to this definition"></a></dt>
<dd><p>Calls the socket <em>recvfrom</em> method and waits for the data,
when the data is received, the method will return a tuple
with the IP of the sender and the data received. When a timeout
exception occurs, the method return None.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">tuple (sender ip, data) or None when timeout exception</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadServer.ident">
<code class="descname">ident</code><a class="headerlink" href="#Network.UDPThreadServer.ident" title="Permalink to this definition"></a></dt>
<dd><p>Thread identifier of this thread or None if it has not been started.</p>
<p>This is a nonzero integer. See the thread.get_ident() function. Thread
identifiers may be recycled when a thread exits and another thread is
created. The identifier is available even after the thread has exited.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.isAlive">
<code class="descname">isAlive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.isAlive" title="Permalink to this definition"></a></dt>
<dd><p>Return whether the thread is alive.</p>
<p>This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.isReady">
<code class="descname">isReady</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.isReady" title="Permalink to this definition"></a></dt>
<dd><p>Returns True when there is data on the pool or False when not</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.is_alive">
<code class="descname">is_alive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.is_alive" title="Permalink to this definition"></a></dt>
<dd><p>Return whether the thread is alive.</p>
<p>This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.join">
<code class="descname">join</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.join" title="Permalink to this definition"></a></dt>
<dd><p>Wait until the thread terminates.</p>
<p>This blocks the calling thread until the thread whose join() method is
called terminates &#8211; either normally or through an unhandled exception
or until the optional timeout occurs.</p>
<p>When the timeout argument is present and not None, it should be a
floating point number specifying a timeout for the operation in seconds
(or fractions thereof). As join() always returns None, you must call
isAlive() after join() to decide whether a timeout happened &#8211; if the
thread is still alive, the join() call timed out.</p>
<p>When the timeout argument is not present or None, the operation will
block until the thread terminates.</p>
<p>A thread can be join()ed many times.</p>
<p>join() raises a RuntimeError if an attempt is made to join the current
thread as that would cause a deadlock. It is also an error to join() a
thread before it has been started and attempts to do so raises the same
exception.</p>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadServer.name">
<code class="descname">name</code><a class="headerlink" href="#Network.UDPThreadServer.name" title="Permalink to this definition"></a></dt>
<dd><p>A string used for identification purposes only.</p>
<p>It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.poolLength">
<code class="descname">poolLength</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.poolLength" title="Permalink to this definition"></a></dt>
<dd><p>Returns the size of the pool</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">integer</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.popPool">
<code class="descname">popPool</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.popPool" title="Permalink to this definition"></a></dt>
<dd><p>Return the last data received on the pool</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.run">
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.run" title="Permalink to this definition"></a></dt>
<dd><p>Called when the thread is started by the user. This method
is the main of the thread, when called, it will enter in loop
to wait data or shutdown when needed.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.setBufferSize">
<code class="descname">setBufferSize</code><span class="sig-paren">(</span><em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.setBufferSize" title="Permalink to this definition"></a></dt>
<dd><p>Sets the receive buffer size</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>size</strong> &#8211; integer</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.shutdown">
<code class="descname">shutdown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.shutdown" title="Permalink to this definition"></a></dt>
<dd><p>Shutdown the server thread, when called, this method will stop
the thread on the next socket timeout</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadServer.start">
<code class="descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadServer.start" title="Permalink to this definition"></a></dt>
<dd><p>Start the thread&#8217;s activity.</p>
<p>It must be called at most once per thread object. It arranges for the
object&#8217;s run() method to be invoked in a separate thread of control.</p>
<p>This method will raise a RuntimeError if called more than once on the
same thread object.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Network.UDPThreadUnicastClient">
<em class="property">class </em><code class="descclassname">Network.</code><code class="descname">UDPThreadUnicastClient</code><span class="sig-paren">(</span><em>host</em>, <em>port</em>, <em>pool_size=10</em>, <em>timeout=0.5</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient" title="Permalink to this definition"></a></dt>
<dd><p>The Unicast UDP client thread class.</p>
<p>This class is a thread to serve as Pyevolve client on the UDP
datagrams, it is used to send data over network lan/wan.</p>
<dl class="docutils">
<dt>Example:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">Network</span><span class="o">.</span><span class="n">UDPThreadClient</span><span class="p">(</span><span class="s1">&#39;192.168.0.2&#39;</span><span class="p">,</span> <span class="mi">1500</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">setData</span><span class="p">(</span><span class="s2">&quot;Test data&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">setTargetHost</span><span class="p">(</span><span class="s1">&#39;192.168.0.50&#39;</span><span class="p">,</span> <span class="mi">666</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">join</span><span class="p">()</span>
</pre></div>
</div>
</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>host</strong> &#8211; the hostname to bind the socket on sender (this is not the target host)</li>
<li><strong>port</strong> &#8211; the sender port (this is not the target port)</li>
<li><strong>pool_size</strong> &#8211; the size of send pool</li>
<li><strong>timeout</strong> &#8211; the time interval to check if the client have data to send</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Network.UDPThreadUnicastClient.addData">
<code class="descname">addData</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.addData" title="Permalink to this definition"></a></dt>
<dd><p>Set the data to send</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> &#8211; the data to send</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the internal socket</p>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadUnicastClient.daemon">
<code class="descname">daemon</code><a class="headerlink" href="#Network.UDPThreadUnicastClient.daemon" title="Permalink to this definition"></a></dt>
<dd><p>A boolean value indicating whether this thread is a daemon thread (True) or not (False).</p>
<p>This must be set before start() is called, otherwise RuntimeError is
raised. Its initial value is inherited from the creating thread; the
main thread is not a daemon thread and therefore all threads created in
the main thread default to daemon = False.</p>
<p>The entire Python program exits when no alive non-daemon threads are
left.</p>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadUnicastClient.ident">
<code class="descname">ident</code><a class="headerlink" href="#Network.UDPThreadUnicastClient.ident" title="Permalink to this definition"></a></dt>
<dd><p>Thread identifier of this thread or None if it has not been started.</p>
<p>This is a nonzero integer. See the thread.get_ident() function. Thread
identifiers may be recycled when a thread exits and another thread is
created. The identifier is available even after the thread has exited.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.isAlive">
<code class="descname">isAlive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.isAlive" title="Permalink to this definition"></a></dt>
<dd><p>Return whether the thread is alive.</p>
<p>This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.isReady">
<code class="descname">isReady</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.isReady" title="Permalink to this definition"></a></dt>
<dd><p>Returns True when there is data on the pool or False when not</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.is_alive">
<code class="descname">is_alive</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.is_alive" title="Permalink to this definition"></a></dt>
<dd><p>Return whether the thread is alive.</p>
<p>This method returns True just before the run() method starts until just
after the run() method terminates. The module function enumerate()
returns a list of all alive threads.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.join">
<code class="descname">join</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.join" title="Permalink to this definition"></a></dt>
<dd><p>Wait until the thread terminates.</p>
<p>This blocks the calling thread until the thread whose join() method is
called terminates &#8211; either normally or through an unhandled exception
or until the optional timeout occurs.</p>
<p>When the timeout argument is present and not None, it should be a
floating point number specifying a timeout for the operation in seconds
(or fractions thereof). As join() always returns None, you must call
isAlive() after join() to decide whether a timeout happened &#8211; if the
thread is still alive, the join() call timed out.</p>
<p>When the timeout argument is not present or None, the operation will
block until the thread terminates.</p>
<p>A thread can be join()ed many times.</p>
<p>join() raises a RuntimeError if an attempt is made to join the current
thread as that would cause a deadlock. It is also an error to join() a
thread before it has been started and attempts to do so raises the same
exception.</p>
</dd></dl>

<dl class="attribute">
<dt id="Network.UDPThreadUnicastClient.name">
<code class="descname">name</code><a class="headerlink" href="#Network.UDPThreadUnicastClient.name" title="Permalink to this definition"></a></dt>
<dd><p>A string used for identification purposes only.</p>
<p>It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor.</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.poolLength">
<code class="descname">poolLength</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.poolLength" title="Permalink to this definition"></a></dt>
<dd><p>Returns the size of the pool</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">integer</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.popPool">
<code class="descname">popPool</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.popPool" title="Permalink to this definition"></a></dt>
<dd><p>Return the last data received on the pool</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.run">
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.run" title="Permalink to this definition"></a></dt>
<dd><p>Method called when you call <em>.start()</em> of the thread</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.send">
<code class="descname">send</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.send" title="Permalink to this definition"></a></dt>
<dd><p>Send the data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> &#8211; the data to send</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bytes sent to each destination</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.setMultipleTargetHost">
<code class="descname">setMultipleTargetHost</code><span class="sig-paren">(</span><em>address_list</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.setMultipleTargetHost" title="Permalink to this definition"></a></dt>
<dd><p>Sets multiple host/port targets, the destinations</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>address_list</strong> &#8211; a list with tuples (ip, port)</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.setTargetHost">
<code class="descname">setTargetHost</code><span class="sig-paren">(</span><em>host</em>, <em>port</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.setTargetHost" title="Permalink to this definition"></a></dt>
<dd><p>Set the host/port of the target, the destination</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>host</strong> &#8211; the target host</li>
<li><strong>port</strong> &#8211; the target port</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">the host will be ignored when using broadcast mode</p>
</div>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.shutdown">
<code class="descname">shutdown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.shutdown" title="Permalink to this definition"></a></dt>
<dd><p>Shutdown the server thread, when called, this method will stop
the thread on the next socket timeout</p>
</dd></dl>

<dl class="method">
<dt id="Network.UDPThreadUnicastClient.start">
<code class="descname">start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.UDPThreadUnicastClient.start" title="Permalink to this definition"></a></dt>
<dd><p>Start the thread&#8217;s activity.</p>
<p>It must be called at most once per thread object. It arranges for the
object&#8217;s run() method to be invoked in a separate thread of control.</p>
<p>This method will raise a RuntimeError if called more than once on the
same thread object.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="Network.getMachineIP">
<code class="descclassname">Network.</code><code class="descname">getMachineIP</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#Network.getMachineIP" title="Permalink to this definition"></a></dt>
<dd><p>Return all the IPs from current machine.</p>
<dl class="docutils">
<dt>Example:</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Util</span><span class="o">.</span><span class="n">getMachineIP</span><span class="p">()</span>
<span class="go">[&#39;200.12.124.181&#39;, &#39;192.168.0.1&#39;]      </span>
</pre></div>
</div>
</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">a python list with the string IPs</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="Network.pickleAndCompress">
<code class="descclassname">Network.</code><code class="descname">pickleAndCompress</code><span class="sig-paren">(</span><em>obj</em>, <em>level=9</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.pickleAndCompress" title="Permalink to this definition"></a></dt>
<dd><p>Pickles the object and compress the dumped string with zlib</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>obj</strong> &#8211; the object to be pickled</li>
<li><strong>level</strong> &#8211; the compression level, 9 is the best
and -1 is to not compress</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="Network.unpickleAndDecompress">
<code class="descclassname">Network.</code><code class="descname">unpickleAndDecompress</code><span class="sig-paren">(</span><em>obj_dump</em>, <em>decompress=True</em><span class="sig-paren">)</span><a class="headerlink" href="#Network.unpickleAndDecompress" title="Permalink to this definition"></a></dt>
<dd><p>Decompress a zlib compressed string and unpickle the data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>obj</strong> &#8211; the object to be decompressend and unpickled</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>


          </div>
        </div>
      </div>

      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
  <li><a href="modules.html">Modules</a><ul>
  <li><a href="module_pyevolve.html"><code class="docutils literal"><span class="pre">pyevolve</span></code> &#8211; the main pyevolve namespace</a><ul>
      <li>Previous: <a href="module_util.html" title="previous chapter"><code class="docutils literal"><span class="pre">Util</span></code> &#8211; utility module</a></li>
      <li>Next: <a href="module_migration.html" title="next chapter"><code class="docutils literal"><span class="pre">Migration</span></code> &#8211; the migration schemes, distributed GA</a></li>
  </ul></li>
  </ul></li>
  </ul></li>
</ul>
</div>

<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>

        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2010, Christian S. Perone.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.6</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.7</a>
      
    </div>

    

    
  </body>
</html>