Commit 67ce889eda65de620893fec99f1dba181e27fc17

Authored by Rémi Emonet
1 parent 6f941d1dd6
Exists in master

go

Showing 2 changed files with 439 additions and 4 deletions

... ... @@ -54,9 +54,17 @@
54 54 </div>
55 55 <h2>Other Resources</h2>
56 56 <div>
57   - <a href="practical-1.pdf">Practical (1)</a>
58   - <a href="raw/practical1.zip">Pr. (1) java</a>
59   - <a href="raw/practical1py.zip">Pr. (1) python</a>
  57 + <div class="tile">
  58 + Practical (1)
  59 + <a href="practical-1.pdf">pdf</a>
  60 + <a href="raw/practical1.zip">java</a>
  61 + <a href="raw/practical1py.zip">py</a>
  62 + </div>
  63 +
  64 + <div class="tile">
  65 + <a href="more-projects.html">PROJECT <br/> instructions</a>
  66 + </div>
  67 +
60 68 <!--
61 69 <a href="ex1.pdf">Exercices (1)</a>
62 70 <a href="raw/socket-code-end-lesson7.zip">Socket Code <br/> (lesson-7's end)</a>
... ... @@ -66,7 +74,7 @@
66 74  
67 75 <a href="more-projects.html">PROJECT <br/> instructions</a>
68 76 <a href="raw/plan-defenses.html">Defenses <br/> Planing</a>
69   --->
  77 +
70 78  
71 79 <!--a href="aide/fonctions-utiles.md">Fichier texte, à compléter : Listes de fonctions utiles</a>
72 80 <a href="aide/fonctions-utiles.html">Listes de fonctions utiles</a-->
more-projects.html View file @ 67ce889
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 +<html xmlns="http://www.w3.org/1999/xhtml">
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5 + <meta http-equiv="Content-Style-Type" content="text/css" />
  6 + <meta name="generator" content="pandoc" />
  7 + <title></title>
  8 + <style type="text/css">
  9 +div.sourceCode { overflow-x: auto; }
  10 +table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
  11 + margin: 0; padding: 0; vertical-align: baseline; border: none; }
  12 +table.sourceCode { width: 100%; line-height: 100%; }
  13 +td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
  14 +td.sourceCode { padding-left: 5px; }
  15 +code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
  16 +code > span.dt { color: #902000; } /* DataType */
  17 +code > span.dv { color: #40a070; } /* DecVal */
  18 +code > span.bn { color: #40a070; } /* BaseN */
  19 +code > span.fl { color: #40a070; } /* Float */
  20 +code > span.ch { color: #4070a0; } /* Char */
  21 +code > span.st { color: #4070a0; } /* String */
  22 +code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
  23 +code > span.ot { color: #007020; } /* Other */
  24 +code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
  25 +code > span.fu { color: #06287e; } /* Function */
  26 +code > span.er { color: #ff0000; font-weight: bold; } /* Error */
  27 +code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
  28 +code > span.cn { color: #880000; } /* Constant */
  29 +code > span.sc { color: #4070a0; } /* SpecialChar */
  30 +code > span.vs { color: #4070a0; } /* VerbatimString */
  31 +code > span.ss { color: #bb6688; } /* SpecialString */
  32 +code > span.im { } /* Import */
  33 +code > span.va { color: #19177c; } /* Variable */
  34 +code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
  35 +code > span.op { color: #666666; } /* Operator */
  36 +code > span.bu { } /* BuiltIn */
  37 +code > span.ex { } /* Extension */
  38 +code > span.pp { color: #bc7a00; } /* Preprocessor */
  39 +code > span.at { color: #7d9029; } /* Attribute */
  40 +code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
  41 +code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
  42 +code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
  43 +code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
  44 + </style>
  45 + <link rel="stylesheet" href="https://cdn.jsdelivr.net/picnicss/6.2.3/picnic.min.css" type="text/css" />
  46 +
  47 +<style type="text/css">
  48 + body {font: arial;}
  49 + body {margin: 15px;}
  50 + body.constrained {margin: auto; max-width: 1000px;}
  51 + h1 {background: #fdb863; border: 1px solid black; text-align: center; padding: 5px; font-size: 1.15em;}
  52 + h2 {color: #e66101; font-size: 1.05em; margin-left: 0.5em;}
  53 + h3 {color: #5e3c99;font-size: 0.95em; margin-left: 1em;}
  54 + h3, p {margin-left: 1em;}
  55 + .en {float:left; clear:left; width: 45%; margin-left: 2%;}
  56 + .fr {float:right; clear:right; width: 45%; margin-right: 2%;}
  57 + .clear {clear:both;}
  58 + pre {margin-left: 30px; border: 1px solid #333; padding: 10px; background: #EEF;}
  59 + pre>code {background: none !important; border: none !important;}
  60 + em {color: darkgreen;}
  61 + code:not(.sourceCode) {background: #EEE; margin: -2px; padding: 2px; border: 1px solid #DDD}
  62 + .lineNumbers {width: 40px;}
  63 +
  64 + .WARN {background: red;}
  65 + .WARN code {background: black; color: white;}
  66 + blockquote {border: 1px solid grey; border-left: 3px solid black; padding: 0;}
  67 + blockquote p {padding: 0;}
  68 +</style>
  69 +<script>
  70 + window.onload = function() {
  71 + if (window.location.hash != "") {
  72 + window.document.body.classList.remove("constrained");
  73 + setTimeout(function() {history.go(0)}, 2000);
  74 + }
  75 + }
  76 +</script>
  77 +
  78 +</head>
  79 +<body class="constrained">
  80 +<h2 id="updates">Updates</h2>
  81 +<!--
  82 +- Updated deliverable and defense dates.
  83 +
  84 +- Details on the protocol.md file: explain what is meant by
  85 +-->
  86 +<h3 id="section">2017-01-24</h3>
  87 +<ul>
  88 +<li>First version, with general instructions and deliverables</li>
  89 +</ul>
  90 +<h1 id="expectations-for-the-project">Expectations for the Project</h1>
  91 +<p>The project will be evaluated based on your ability to show you acquired knowledge and skills about peer to peer (P2P), network programming, concurrent programming and software engineering. You'll be working in groups (of 3/4 students) and you'll probably share the work load. While only some of you might fight with each particular line of code and detail, it is expected that each group member have an understanding of the project as a whole (and can explain any of its parts).</p>
  92 +<p>A good project, deliverables and defense should show that you understood and know how to:</p>
  93 +<ul>
  94 +<li>organize yourselves,</li>
  95 +<li>design a protocol,</li>
  96 +<li>structure a P2P system,</li>
  97 +<li>use TCP sockets,</li>
  98 +<li>handle mixed text/binary data,</li>
  99 +<li>test your software properly,</li>
  100 +<li>learn from your experience by conducting a proper retrospective,</li>
  101 +<li>present your work,</li>
  102 +<li>use the git version control system to collaborate cleanly.</li>
  103 +</ul>
  104 +<h2 id="instructions-for-good-development-practices">Instructions for Good Development Practices</h2>
  105 +<p>About documents:</p>
  106 +<ul>
  107 +<li>write your documentation in markdown (.md) so that it is automatically nicely display in github (check that it is displayed well)</li>
  108 +</ul>
  109 +<p>About git:</p>
  110 +<ul>
  111 +<li>do not commit generated files (and use a <code>.gitignore</code> so that <code>git status</code> shows up clean),</li>
  112 +<li>do not use git just to store a zip of your project,</li>
  113 +<li>if your repository starts to reach several MB in size, there is probably an issue,</li>
  114 +<li>commit/push often, so you don't fear making changes,</li>
  115 +<li>provide good commit messages (e.g., see a <a href="http://chris.beams.io/posts/git-commit/">post about commit messages</a>) that describe the changes and the reason for these changes,</li>
  116 +<li>use English for all commit messages,</li>
  117 +<li>if you pair-program in front of single machine, mention in the message who contributed to the commit (you'd be surprised how fast you can forget who did what on a project),</li>
  118 +</ul>
  119 +<p>About your code:</p>
  120 +<ul>
  121 +<li>write your code in English,</li>
  122 +<li>indent/format your code properly, learn how to use your tools to do it,</li>
  123 +<li>avoid mixing spaces and tabs (ideally, don't use tabulations),</li>
  124 +<li>keep your code clean: do not use global/static variables, choose your names carefully (packages, classes, functions, etc), follow some/the conventions (e.g., <a href="http://www.oracle.com/technetwork/java/codeconventions-135099.html">java convention</a>), use constants for constant values, ...</li>
  125 +</ul>
  126 +<p>You're writing software, and especially networking and concurrent software, so:</p>
  127 +<ul>
  128 +<li>test a lot and often,</li>
  129 +<li>have automated tests,</li>
  130 +<li>have stress tests,</li>
  131 +<li>have tests for &quot;bad&quot; behaviors from other peers (e.g., a peer connecting but not sending anything),</li>
  132 +<li>document how to use, compile, test and start your project,</li>
  133 +<li>document how to understand and continue your project.</li>
  134 +</ul>
  135 +<h2 id="reuse-and-attribution">Reuse and Attribution</h2>
  136 +<p>Whenever re-used code/text/definitions/... coming from external sources, <strong>you must properly cite your sources</strong>. In particular, your must specify in your README.md (in your git repository) the source of external code you used, who are the authors, what is the license, and what effort you had to make to understand and integrate, ... Not doing this properly may be against the law (license terms) and against the university policies (in french, <a href="http://www.universite-lyon.fr/plagiat" class="uri">http://www.universite-lyon.fr/plagiat</a>).</p>
  137 +<h2 id="project-deliverables-via-github">Project deliverables (via github)</h2>
  138 +<p>For all deliverables, I will clone the project from your github repository (no handing-in by email or other means). This can happen at any the moment after the date is passed.</p>
  139 +<p>All textual documents should preferably be in a text-based format, such as <code>.md</code> (markdown <a href="https://help.github.com/articles/github-flavored-markdown/" class="uri">https://help.github.com/articles/github-flavored-markdown/</a>) that displays nicely on github.</p>
  140 +<h3 id="protocol-specification-february-6-13h00">Protocol Specification (February 6, 13h00)</h3>
  141 +<p>Your repository <strong>must</strong> contain, at least, the following element. A file named <code>protocol.md</code>, that describes your protocol in sufficient details, such that someone else could read it and implement a peer that is compatible with yours. This work has to be done in metagroups (see the group composition email). Each group <strong>must</strong> commit a protocol description but it should be the same for all groups in a meta-group.</p>
  142 +<p>Describing a protocol involves different aspects, for which you can find examples in the courses:</p>
  143 +<ul>
  144 +<li>what programs sends what messages to what other program,</li>
  145 +<li>when each message is sent (and in which order their are sent),</li>
  146 +<li>what is the content of each exchanged message,</li>
  147 +<li>what is the semantic/meaning of each message,</li>
  148 +<li>what is the data format of the messages (how it is actually encoded/serialized on the network),</li>
  149 +<li>etc.</li>
  150 +</ul>
  151 +<h3 id="final-deliverable-march-16-23h59">Final Deliverable (March 16, 23h59)</h3>
  152 +<p>Your repository <strong>must</strong> contain, at least, the following elements:</p>
  153 +<ul>
  154 +<li><code>protocol.md</code>
  155 +<ul>
  156 +<li>your protocol description, in its updated version, if you changed the protocol since the first deliverable</li>
  157 +</ul></li>
  158 +<li><code>README.md</code>
  159 +<ul>
  160 +<li>a paragraph at least about your subject</li>
  161 +<li>instructions on how to obtain, build, run, test, ..., your project</li>
  162 +<li>a description of the architecture (what parts interacts how with what other parts)</li>
  163 +</ul></li>
  164 +<li><code>retrospective.md</code>, about organization of the work, technology, etc
  165 +<ul>
  166 +<li>compared to your objectives: what works, what does not work yet</li>
  167 +<li>the difficulties you faced</li>
  168 +<li>the lessons you learned</li>
  169 +<li>what you would keep for next time</li>
  170 +<li>what you would do differently</li>
  171 +</ul></li>
  172 +<li><code>auto-evaluation.md</code>, which should contain:
  173 +<ul>
  174 +<li>the time spent (in hours) by each member of the project</li>
  175 +<li>the parts on which each member worked</li>
  176 +<li>for each item in the “Good Development Practices” section, an evaluation of how much you followed the practice</li>
  177 +</ul></li>
  178 +</ul>
  179 +<h3 id="project-defense-march-20">Project Defense (March 20)</h3>
  180 +<p>NB: the organization of the defense might change, more on that later.</p>
  181 +<p>The first part of your defense should be a product presentation, as if you were presenting/selling your project to a semi-technical client, not detailing too much the low level details. The “retrospective” part should be an honest evaluation of your work. Ideally, your slides should also be committed in your git repository.</p>
  182 +<h3 id="typical-defense-indicative-timings-for-a-4-person-group">Typical Defense (indicative timings for a 4-person group)</h3>
  183 +<ul>
  184 +<li>2 minutes: setup in the room</li>
  185 +<li>5 minutes with slides: presentation of the project, what have been done, your choices, ...</li>
  186 +<li>5 minutes: project demo, ideally with multiple machines (the wifi router will be available)</li>
  187 +<li>5 minutes with slides: retrospective, how you worked in your group, auto-evaluation, what worked well, what was difficult, what you learned, strong/weak points of the projects (on the methodology and results)</li>
  188 +<li>5 minutes: questions</li>
  189 +</ul>
  190 +<h1 id="project-description-and-links">Project Description and Links</h1>
  191 +<p>Let's start with some reminders from the lessons. NB: you can navigate the slides using the left/right arrow keys or 'a'/'z' (you might need to click on the slide to give the focus first).</p>
  192 +<ul>
  193 +<li>Some slides about the project: <a href="./lesson-02.html#slide-27">lesson-02.html#slide-27</a></li>
  194 +<li>Some slides about bittorent: <a href="./lesson-04.html#slide-10">lesson-04.html#slide-10</a></li>
  195 +</ul>
  196 +<h2 id="peer-to-peer-file-sharing-terms-and-conditions">Peer to peer file sharing (terms and conditions)</h2>
  197 +<p>The goal of the project is to implement a peer-to-peer system inspired by BitTorrent, but different. Our system will not be compatible with BitTorrent. To avoid misunderstanding (on compatibility), we will use the following terms:</p>
  198 +<ul>
  199 +<li><em>Composition</em> (the actual data to share)
  200 +<ul>
  201 +<li>this can be any kind of file (video, music, ...)</li>
  202 +<li>as an extension, this could also be a set of files</li>
  203 +<li>each <em>composition</em> will be split into <em>parts</em></li>
  204 +</ul></li>
  205 +<li><em>Orchestra</em> (“torrent file” in BitTorrent)
  206 +<ul>
  207 +<li>this is a description of the <em>composition</em> to exchange</li>
  208 +<li>it can be stored as a text file that will be shared to all <em>members</em> (in a real case, this file could be stored on a webserver named “l411.me” that lists <em>orchestra</em> files)</li>
  209 +<li>the file extension <code>.orch</code> will be used</li>
  210 +<li>it contains the following informations
  211 +<ul>
  212 +<li>the address of the <em>conductor</em> (e.g., <code>192.168.6.66:42000</code>)</li>
  213 +<li>the name of the <em>composition</em></li>
  214 +<li>the size of the <em>composition</em></li>
  215 +<li>the size used for <em>parts</em></li>
  216 +<li>the number of <em>parts</em> (not mandatory, this is redundant)</li>
  217 +<li>for each <em>part</em>, its <em>SHA1</em></li>
  218 +</ul></li>
  219 +</ul></li>
  220 +<li><em>Part</em> (“piece” in BitTorrent)
  221 +<ul>
  222 +<li>this represents a part of a <em>composition</em> to download</li>
  223 +<li>this is the unit of exchange: <em>members</em> exchange <em>parts</em></li>
  224 +<li><em>parts</em> are all of the same size, except the last one (if the <em>composition</em> size is not a multiple of the <em>part</em> size)</li>
  225 +<li>the size of the <em>parts</em> is decided when creating the <em>orchestra</em> (e.g., 2kB)</li>
  226 +<li><em>SHA1</em>
  227 +<ul>
  228 +<li>this is a type of checksum that we will use to check the integrity of a <em>part</em></li>
  229 +<li>it is stored in the <em>orchestra</em> file</li>
  230 +<li>it is checked by the <em>member</em> when receiving a <em>part</em> (or when restarting with from a partially downloaded <em>composition</em>)</li>
  231 +</ul></li>
  232 +</ul></li>
  233 +<li><em>Member</em> (“peer” in BitTorrent)
  234 +<ul>
  235 +<li>this is a program exchanging <em>parts</em> with others <em>members</em></li>
  236 +<li>it first loads a <em>orchestra</em> file</li>
  237 +<li>it finds others <em>members</em> by querying the <em>conductor</em></li>
  238 +<li>it remembers (in memory) the <em>SHA1</em> of each <em>part</em></li>
  239 +<li>it remembers what <em>part</em> it has, and shares this information with others <em>members</em></li>
  240 +<li>it can ask <em>parts</em> to other <em>members</em></li>
  241 +<li>it can provide <em>parts</em> to other <em>members</em></li>
  242 +</ul></li>
  243 +<li><em>Conductor</em> (“tracker” in BitTorrent)
  244 +<ul>
  245 +<li>this is a program that maintains an updated list of all <em>members</em> exchanging the <em>composition</em></li>
  246 +<li>it provides, on demand by a <em>member</em>, a list of other <em>members</em> to connect to</li>
  247 +<li>it does nothing else: it does not download or upload any <em>part</em>, does not know what <em>member</em> has what <em>parts</em>, etc.</li>
  248 +</ul></li>
  249 +</ul>
  250 +<p>To have a functional peer-to-peer system, you will thus need to write 3 programs:</p>
  251 +<ul>
  252 +<li>A plain program named composer (used before starting to share some <em>composition</em>) that generates the <code>.orch</code> file corresponding to some <em>composition</em>.</li>
  253 +<li>A networked program named <em>conductor</em> (that will be started only once for any <em>orchestra</em>) which role is described above.</li>
  254 +<li>A networked program named <em>member</em> (that will be started by each user that want to download or share the <em>composition</em>) that .</li>
  255 +</ul>
  256 +<h2 id="help-with-the-composer">Help with the composer</h2>
  257 +<p>The composer, in its simple form, takes a file (e.g. a video file) and generates a <code>.orch</code> <em>orchestra</em> file. From a programming point of view, your program should receive the (input) filename of the <em>composition</em> and the (output) filename of the <em>orchestra</em> file.</p>
  258 +<p>It is recommended to write and use a utility function to convert any binary data (<code>byte[]</code> in Java) to a <em>SHA1</em> (String), so that this function can be reused also in the <em>member</em>. To make the project easier, here is a possible hashing function, using Java's <code>MessageDigest</code> class:</p>
  259 +<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"> <span class="co">// inspired by: http://www.mkyong.com/java/how-to-generate-a-file-checksum-value-in-java/</span>
  260 + <span class="kw">public</span> <span class="dt">static</span> String <span class="fu">bytesToSHA1</span>(<span class="dt">byte</span>[] bytes) {
  261 + <span class="kw">try</span> {
  262 + MessageDigest messageDigest = MessageDigest.<span class="fu">getInstance</span>(<span class="st">&quot;SHA1&quot;</span>);
  263 + <span class="dt">byte</span>[] digestedBytes = messageDigest.<span class="fu">digest</span>(bytes);
  264 +
  265 + <span class="co">// convert the digestedBytes to hexadecimal format to reduce the size of the ouput</span>
  266 + String result = <span class="st">&quot;&quot;</span>;
  267 + <span class="kw">for</span> (<span class="dt">int</span> i = <span class="dv">0</span>; i &lt; digestedBytes.<span class="fu">length</span>; i++) {
  268 + result += Integer.<span class="fu">toString</span>((digestedBytes[i] &amp; <span class="bn">0xff</span>) + <span class="bn">0x100</span>, <span class="dv">16</span>).<span class="fu">substring</span>(<span class="dv">1</span>);
  269 + }
  270 + <span class="kw">return</span> result;
  271 + } <span class="kw">catch</span> (NoSuchAlgorithmException e) {
  272 + e.<span class="fu">printStackTrace</span>();
  273 + <span class="kw">return</span> <span class="kw">null</span>;
  274 + }
  275 + }</code></pre></div>
  276 +<p>The composer should read the file, <em>part</em> by <em>part</em>, and compute the <em>SHA1</em> of each <em>part</em>, writing the meaningful information in the <em>orchestra</em> file. You can use, in Java, the <code>FileInputStream</code> and <code>FileOutputStream</code> classes. You can use the <code>read(byte[] b, int off, int len)</code> method in <code>InputStream</code>, but be careful to read the documentation properly. Be also careful to handle the last <em>part</em> properly (it is most of time smaller than the other ones).</p>
  277 +<h2 id="help-with-the-conductor-options-only-if-you-base-system-works">Help with the <em>conductor</em> (+options, only if you base system works)</h2>
  278 +<p>The <em>conductor</em> is a TCP server that accepts connections from the <em>members</em> and answer their requests. As a summary:</p>
  279 +<ul>
  280 +<li>the <em>conductor</em> accepts <em>members</em> as clients</li>
  281 +<li>the <em>conductor</em> maintains a list of existing <em>members</em> (for its <em>composition</em>)</li>
  282 +<li>when a <em>member</em> asks the <em>conductor</em> for a list of other <em>members</em>, the <em>conductor</em> randomly selects and send a sub-part of the complete list of <em>members</em> (e.g., sends a list of at most 10 <em>members</em>)</li>
  283 +<li>periodically, the <em>conductor</em> checks that each <em>member</em> is still alive and responding, in order to maintain the list of peers clean,</li>
  284 +<li>the <em>conductor</em> doesn't need to have the <em>orchestra</em> file</li>
  285 +</ul>
  286 +<p><strong>(option)</strong> A <em>conductor</em> can also handle multiple <em>orchestra</em> at the same time (acting as a <em>conductor</em> for multiple <em>composition</em>). This option requires to update the <em>member</em> too.</p>
  287 +<p><strong>(option)</strong> A <em>conductor</em> can also periodically ask the <em>members</em> what <em>parts</em> they have and try to be smart when a new <em>member</em> asks for a list of <em>members</em>. Warning: it is sometimes difficult to be smarter than random (without creating critical corner cases).</p>
  288 +<h2 id="help-with-the-member-options-only-if-you-base-system-works">Help with the <em>member</em> (+options, only if you base system works)</h2>
  289 +<p>A <em>member</em> is a TCP server that accepts connections from others <em>members</em>, but it also connects to <em>conductor</em> (to get the addresses of other <em>members</em>) and to other <em>members</em> (to exchange <em>parts</em>).</p>
  290 +<ul>
  291 +<li>the <em>member</em> load a <em>orchestra</em> file from the hard drive</li>
  292 +<li>the <em>member</em> loads the corresponding <em>composition</em> from the hard drive, if it has it</li>
  293 +<li>if the <em>member</em> had the file, it must check which <em>parts</em> are valid, using the <em>SHA1</em></li>
  294 +<li>the <em>member</em> connects to the <em>conductor</em> to ask a list of other <em>members</em></li>
  295 +<li>the <em>member</em> connects to each such other <em>member</em>, and they exchange the list of <em>parts</em> they have</li>
  296 +<li>the <em>member</em> asks a missing <em>part</em> to another <em>member</em>, following its own strategy (random can be ok)</li>
  297 +<li>the <em>member</em> sends a <em>part</em> to another <em>member</em> asks it</li>
  298 +<li>the exchanges between <em>members</em> must happen in parallel (a <em>member</em> asks multiple <em>parts</em> to multiple <em>members</em> but also answers to the requests from other <em>members</em>),</li>
  299 +<li>the <em>members</em> periodically exchange the list of <em>parts</em> they have</li>
  300 +<li>from time to time (depending on its strategy), the <em>member</em> asks a new list to the <em>conductor</em> and to these <em>members</em></li>
  301 +<li>when the <em>composition</em> is complete or the application is closed, the <em>member</em> saves it to disk</li>
  302 +</ul>
  303 +<p>This can be easier to implement or seen as an option. The <em>member</em> can create, from the beginning, a file with the proper size (the size of the <em>composition</em>), with a random content, and save each <em>part</em> as soon as it is validly received (using for instance Random Access files). This lowers the memory requirements for the peers, but might use the hard drive more.</p>
  304 +<p><strong>(option)</strong> When a <em>member</em> receives a list of other <em>members</em> and tries to connect to them, if a connection problem happens, it can “complain” to the <em>conductor</em>. The <em>conductor</em> can then trigger the “liveliness” test on this peer, leading to a faster cleanup of its <em>members</em> list.</p>
  305 +<p><strong>(option)</strong> Implement and compare different strategies on the choice of <em>members</em>/that the <em>member</em> decide to ask.</p>
  306 +<p><strong>(option)</strong> Make the <em>composition</em> being possibly composed of multiple files (or even folders and subfolders). This option probably requires the adaptation of the composer.</p>
  307 +<h2 id="general-help">General help</h2>
  308 +<p>To test on different machines, you won't be able to use the university wifi. You can use a smartphone to setup a dedicated wifi, by using the “wifi tethering” option (even if you have no data connection (Edge, 3G, etc) on your phone).</p>
  309 +<p>In Java, the <code>Map</code> hols a key→value association and is very very useful. If “keys” are simple integers, starting from <span class="math inline">0</span> to <span class="math inline"><em>N</em> − 1</span> (with <span class="math inline"><em>N</em></span> known), then an array might as well work.</p>
  310 +<p>You'll have to mix textual and binary data in your network exchanges, you can use the <code>readLine</code> reimplementation done in the course. You should also use the principle of message queues (<code>BlockingQueue</code>) seen in the course.</p>
  311 +<p>An interesting tip, when using a queue: not all messages have to come from the network and a thread can even send itself some message. Following this reasoning, another trick to help implementing a timeout, is to use a Java <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Timer.html">Timer</a> that sends adds a message to a queue after some delay:</p>
  312 +<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"> <span class="dt">long</span> dur = <span class="dv">5000</span>;
  313 + Timer t = <span class="kw">new</span> Timer(<span class="kw">true</span>);
  314 + t.<span class="fu">schedule</span>(<span class="kw">new</span> TimerTask() {
  315 + <span class="fu">@Override</span> <span class="kw">public</span> <span class="dt">void</span> <span class="fu">run</span>() { <span class="kw">try</span> {
  316 + blockingQueue.<span class="fu">put</span>(<span class="kw">new</span> <span class="fu">Message</span>(<span class="kw">null</span>, <span class="st">&quot;COOL COOCOOCOOL&quot;</span>));
  317 + } <span class="kw">catch</span> (InterruptedException ex) {
  318 + Logger.<span class="fu">getLogger</span>(<span class="kw">this</span>.<span class="fu">getClass</span>().<span class="fu">getName</span>()).<span class="fu">log</span>(Level.<span class="fu">SEVERE</span>, <span class="kw">null</span>, ex);
  319 + }}
  320 + }, dur);</code></pre></div>
  321 +<h2 id="teams-groups-etc">Teams, Groups, etc</h2>
  322 +<h3 id="group-a-abc">Group A − ??? − ABC</h3>
  323 +<ul>
  324 +<li>Sana HOUCH − SanaHOUCH</li>
  325 +<li>Anas BENAMOU − anbanasmou</li>
  326 +<li>Feras AL-KASSAR − enferas</li>
  327 +</ul>
  328 +<h3 id="group-b-java-abc">Group B − Java − ABC</h3>
  329 +<ul>
  330 +<li>Amine IDIR − idiramine</li>
  331 +<li>Youssef DRIDI − DrYous</li>
  332 +<li>Youssef MCHICH − youssefmchich</li>
  333 +</ul>
  334 +<h3 id="group-c-java-abc">Group C − Java − ABC</h3>
  335 +<ul>
  336 +<li>Oussama BOULDJEDRI − Oussamab21</li>
  337 +<li>Usama JAVAID − Usama113</li>
  338 +<li>Joe RENNER − joerenner</li>
  339 +<li>Austin SCHWINN − amschwinn</li>
  340 +</ul>
  341 +<h3 id="group-d-python-def-torrentnchill">Group D − Python − DEF − torrentNchill</h3>
  342 +<ul>
  343 +<li>Sejal JAISWAL − druaGa</li>
  344 +<li>Jorge CHANG − fortachong</li>
  345 +<li>Edward BEECHING − edbeeching</li>
  346 +</ul>
  347 +<h3 id="group-e-java-def">Group E − Java − DEF</h3>
  348 +<ul>
  349 +<li>Valentin BENOZILLO − koolok</li>
  350 +<li>Mathieu VIOLA − mathieu-viola</li>
  351 +<li>Rémi VIOLA − RemiViola</li>
  352 +</ul>
  353 +<h3 id="group-f-java-def">Group F − Java − DEF</h3>
  354 +<ul>
  355 +<li>Dimitris TSALOKIDIS − EucliTs0</li>
  356 +<li>Maedeh AFSHARI − sanazafshari</li>
  357 +<li>Ishwar PURUSHOTHAM − ratatouille17</li>
  358 +<li>Kahina OUZIA − Kahi-Na</li>
  359 +</ul>
  360 +<h3 id="group-g-python-ghi-workbees">Group G − Python − GHI − Work Bees</h3>
  361 +<ul>
  362 +<li>Renuka CHITTIMALA − renukachittimalla</li>
  363 +<li>Marouane GAZOUZI − Kimeur</li>
  364 +<li>Arunava MAULIK − Arunavameister</li>
  365 +</ul>
  366 +<h3 id="group-h-java-ghi">Group H − Java − GHI</h3>
  367 +<ul>
  368 +<li>Clement SCHMIT − ???</li>
  369 +<li>Jérémie BLANCHARD − ???</li>
  370 +<li>Josselin MARNAT − ???</li>
  371 +<li>Anthony DEVEAUX − ???</li>
  372 +</ul>
  373 +<h3 id="group-i-java-ghi">Group I − Java − GHI</h3>
  374 +<ul>
  375 +<li>Aka Pierre Marie COBBOLD − cedriccob</li>
  376 +<li>Edhatt RAGEL − Edhatt</li>
  377 +<li>Romaissa KIRECHE − KMaissa</li>
  378 +</ul>
  379 +<h3 id="group-j-python-jkl-voyager">Group J − Python − JKL − Voyager</h3>
  380 +<ul>
  381 +<li>Prem PRAKASH − prem2017</li>
  382 +<li>Navdeep KUMAR − navdeepkaushish</li>
  383 +<li>Rahul CHANDNANI − rahulchandnani</li>
  384 +</ul>
  385 +<h3 id="group-k-java-jkl">Group K − Java − JKL</h3>
  386 +<ul>
  387 +<li>Clement CHAMBON − traglom</li>
  388 +<li>Alexis BARTHELEMY − Sangfer</li>
  389 +<li>Julien BRAT − jbrat</li>
  390 +<li>Kevin ABRIAL − kabrial</li>
  391 +</ul>
  392 +<h3 id="group-l-java-jkl">Group L − Java − JKL</h3>
  393 +<ul>
  394 +<li>Assandi BACO − Bassandi</li>
  395 +<li>Slimane MAKHLOUF − slimaneMakh</li>
  396 +<li>Youcef MESSAOUD − ekehe</li>
  397 +<li>Néssim SLIMANI − Zesskiller</li>
  398 +</ul>
  399 +<!-- clicky Cla -->
  400 +<script type="text/javascript">
  401 +var clicky_site_ids = clicky_site_ids || [];
  402 +clicky_site_ids.push(100779706);
  403 +(function() {
  404 + var s = document.createElement('script');
  405 + s.type = 'text/javascript';
  406 + s.async = true;
  407 + s.src = '//static.getclicky.com/js';
  408 + ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
  409 +})();
  410 +</script>
  411 +<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/100779706ns.gif" /></p></noscript>
  412 +
  413 +
  414 +<!-- Histats.com START (aync)-->
  415 +<script type="text/javascript">var _Hasync= _Hasync|| [];
  416 +_Hasync.push(['Histats.start', '1,2767123,4,0,0,0,00010000']);
  417 +_Hasync.push(['Histats.fasi', '1']);
  418 +_Hasync.push(['Histats.track_hits', '']);
  419 +(function() {
  420 +var hs = document.createElement('script'); hs.type = 'text/javascript'; hs.async = true;
  421 +hs.src = ('http://s10.histats.com/js15_as.js');
  422 +(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(hs);
  423 +})();</script>
  424 +<noscript><a href="http://www.histats.com" target="_blank"><img src="http://sstatic1.histats.com/0.gif?2767123&101" alt="javascript hit counter" border="0"></a></noscript>
  425 +<!-- Histats.com END -->
  426 +</body>
  427 +</html>