<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ro">
	<id>http://wiki.dcae.pub.ro/index.php?action=history&amp;feed=atom&amp;title=OOP_Lab_Task_5</id>
	<title>OOP Lab Task 5 - Revizia istoricului</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.dcae.pub.ro/index.php?action=history&amp;feed=atom&amp;title=OOP_Lab_Task_5"/>
	<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;action=history"/>
	<updated>2026-05-27T07:09:16Z</updated>
	<subtitle>Istoricul versiunilor pentru această pagină din wiki</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5034&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5034&amp;oldid=prev"/>
		<updated>2016-12-22T01:58:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 01:58&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l36&quot; &gt;Linia 36:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 36:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** After you finish with sending messages don&amp;#039;t forget to close the output stream of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object, the input stream and the socket! To be sure that they are closed in any circumstances, put the statements that closes them in a &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block, atached to a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block that encloses the other part of the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared outside the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block and initialized with some value (the initialization value may be null).!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** After you finish with sending messages don&amp;#039;t forget to close the output stream of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object, the input stream and the socket! To be sure that they are closed in any circumstances, put the statements that closes them in a &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block, atached to a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block that encloses the other part of the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared outside the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block and initialized with some value (the initialization value may be null).!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** Because the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method operates with sockets and streams it may also raise checked exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;. You do not catch them; simply declare that the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; throws them out.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** Because the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method operates with sockets and streams it may also raise checked exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;. You do not catch them; simply declare that the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; throws them out.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates a &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object with some destination IP address (try first with 127.0.0.1), and port 9000 (that connects the client&amp;#039;s socket to the destination&amp;#039;s socket, the localhost (127.0.0.1) on port 9000), and calls the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; for the newly created &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;The &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates a &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object with some destination IP address (try first with 127.0.0.1), and port 9000 (that connects the client&amp;#039;s socket to the destination&amp;#039;s socket, the localhost (127.0.0.1) on port 9000), and calls the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; for the newly created &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Because both the &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; constructor and the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method may generate checked exceptions, throw them further outside the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* Because both the &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; constructor and the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method may generate checked exceptions, throw them further outside the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# You may run &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;this file&lt;/del&gt;, to see that it compiles, builds and runs, but the execution will end abruptly with an exception because there is still no server running, to which your client might connect (Connection refused). The following steps are devoted to the other part of the connection, the receiver of messages, which also acts as the server.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# You may run &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; class&lt;/ins&gt;, to see that it compiles, builds and runs, but the execution will end abruptly with an exception because there is still no server running, to which your client might connect (Connection refused). The following steps are devoted to the other part of the connection, the receiver of messages, which also acts as the server.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package a class called &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ServerPeer&amp;lt;/code&amp;gt; with the following features:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package a class called &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ServerPeer&amp;lt;/code&amp;gt; with the following features:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The constructor has as its sole argument a reference to a pre-initialized &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object, that it stores in a private field.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The constructor has as its sole argument a reference to a pre-initialized &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object, that it stores in a private field.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5033&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5033&amp;oldid=prev"/>
		<updated>2016-12-22T01:56:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 01:56&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot; &gt;Linia 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method). This class has&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method). This class has&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A constructor, with two arguments, a string for an internet address, and an integer for a port number. This constructor creates a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object and connects it to the desired remote socket, whose address and port are given as arguments.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A constructor, with two arguments, a string for an internet address, and an integer for a port number. This constructor creates a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object and connects it to the desired remote socket, whose address and port are given as arguments.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#* The &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; reference must be an instance field so that it may be used by the other methods of this class.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;run&amp;lt;/code&amp;gt;, without arguments, which does the following:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;run&amp;lt;/code&amp;gt;, without arguments, which does the following:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* First, it instantiates a &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object with your name as an argument (you are the sender!) and the reference to the &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object as the other argument.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* First, it instantiates a &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object with your name as an argument (you are the sender!) and the reference to the &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object as the other argument.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* After that, open an input stream of characters to read from the keyboard. The input stream from the keyboard is already enclosed in the object &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039;, which is opened and available by default. However, this stream is a byte stream, therefore you need to filter it properly, so that the bytes are transformed to characters. To do that, you enclose the &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039; stream into an &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;InputStreamReader&amp;lt;/code&amp;gt; object. The &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039; object (&amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; is derived from &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039;) delivers the stream character by character. To read a whole line from the keyboard without calling the &amp;#039;&amp;#039;&amp;#039;read&amp;#039;&amp;#039;&amp;#039; method for each character, you enclose further the &amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; into a &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;BufferedReader&amp;lt;/code&amp;gt; object, whose &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method fits this purpose. The &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method returns (with a string) only after you type the &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; key (but the newline character will not be part of the returned string).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* After that, open an input stream of characters to read from the keyboard. The input stream from the keyboard is already enclosed in the object &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039;, which is opened and available by default. However, this stream is a byte stream, therefore you need to filter it properly, so that the bytes are transformed to characters. To do that, you enclose the &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039; stream into an &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;InputStreamReader&amp;lt;/code&amp;gt; object. The &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039; object (&amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; is derived from &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039;) delivers the stream character by character. To read a whole line from the keyboard without calling the &amp;#039;&amp;#039;&amp;#039;read&amp;#039;&amp;#039;&amp;#039; method for each character, you enclose further the &amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; into a &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;BufferedReader&amp;lt;/code&amp;gt; object, whose &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method fits this purpose. The &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method returns (with a string) only after you type the &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; key (but the newline character will not be part of the returned string).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Then, read a string of characters from the keyboard (from the previously opened input stream) and call the &amp;#039;&amp;#039;&amp;#039;sendMessage&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object. Your typed messages will thus be sent to the destination.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* Then, read a string of characters from the keyboard (from the previously opened input stream) and call the &amp;#039;&amp;#039;&amp;#039;sendMessage&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object. Your typed messages will thus be sent to the destination.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* You may send messages in a continuous loop (type a line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;, type another line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; a.s.o).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* You may send messages in a continuous loop (type a line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;, type another line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; a.s.o).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* To break the loop, you test for a special typed line, &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; (it will act like a command, not a message to be sent). Remember how to check that two strings are equal!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* To break the loop, you test for a special typed line, &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; (it will act like a command, not a message to be sent). Remember how to check that two strings are equal!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* After you finish with sending messages don&amp;#039;t forget to close the output stream of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object, the input stream and the socket! To be sure that they are closed in any circumstances, put the statements that closes them in a &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block, atached to a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block that encloses the other part of the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared outside the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block and initialized with some value (the initialization value may be null).!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* After you finish with sending messages don&amp;#039;t forget to close the output stream of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object, the input stream and the socket! To be sure that they are closed in any circumstances, put the statements that closes them in a &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block, atached to a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block that encloses the other part of the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared outside the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block and initialized with some value (the initialization value may be null).!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Because the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method operates with sockets and streams it may also raise checked exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;. You do not catch them; simply declare that the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; throws them out.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* Because the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method operates with sockets and streams it may also raise checked exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;. You do not catch them; simply declare that the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; throws them out.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates a &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object with some destination IP address (try first with 127.0.0.1), and port 9000 (that connects the client&amp;#039;s socket to the destination&amp;#039;s socket, the localhost (127.0.0.1) on port 9000), and calls the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; for the newly created &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates a &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object with some destination IP address (try first with 127.0.0.1), and port 9000 (that connects the client&amp;#039;s socket to the destination&amp;#039;s socket, the localhost (127.0.0.1) on port 9000), and calls the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; for the newly created &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Because both the &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; constructor and the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method may generate checked exceptions, throw them further outside the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Because both the &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; constructor and the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method may generate checked exceptions, throw them further outside the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5032&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5032&amp;oldid=prev"/>
		<updated>2016-12-22T01:08:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 01:08&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l62&quot; &gt;Linia 62:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 62:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Type something in the output window of the Client and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Look to the other tab and see that the Sever outputs the message you have just typed. Try with other messages. To close the Client, type &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Depending on how you have written the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;Server&amp;#039;&amp;#039;&amp;#039; class, the server will end too, or it will continue, listening for other clients to connect (in which case you run again the Client.java, type something a.s.o)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Type something in the output window of the Client and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Look to the other tab and see that the Sever outputs the message you have just typed. Try with other messages. To close the Client, type &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Depending on how you have written the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;Server&amp;#039;&amp;#039;&amp;#039; class, the server will end too, or it will continue, listening for other clients to connect (in which case you run again the Client.java, type something a.s.o)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you want more fun, and know the IP address of the computer of your colleague, ask him to open a server, change your &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; class to open a Socket with that IP instead of the localhost IP 127.0.0.1, and run locally &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a &lt;/del&gt;client. Please, send only peacefull messages!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you want more fun, and know the IP address of the computer of your colleague, ask him to open a server &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;on some port&lt;/ins&gt;, change your &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; class to open a Socket with that IP instead of the localhost IP 127.0.0.1, and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the desired port, then &lt;/ins&gt;run locally &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;your &lt;/ins&gt;client &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and type messages for your colleague&lt;/ins&gt;. Please, send &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;him &lt;/ins&gt;only peacefull messages!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Submitting ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Submitting ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5031&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5031&amp;oldid=prev"/>
		<updated>2016-12-22T01:06:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 01:06&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l61&quot; &gt;Linia 61:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 61:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the Server class (with the Server.java opened in the editor window right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or click &amp;#039;&amp;#039;Run&amp;#039;&amp;#039;-&amp;gt;&amp;#039;&amp;#039;Run File&amp;#039;&amp;#039; from the general Menu). If there are no errors the program runs, but nothing is output, and it appears to run without end. It&amp;#039;s because there are no clients running around and it listens continuously waiting for some client to appear (the &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method returns only after it catches a client, or something bad happens).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the Server class (with the Server.java opened in the editor window right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or click &amp;#039;&amp;#039;Run&amp;#039;&amp;#039;-&amp;gt;&amp;#039;&amp;#039;Run File&amp;#039;&amp;#039; from the general Menu). If there are no errors the program runs, but nothing is output, and it appears to run without end. It&amp;#039;s because there are no clients running around and it listens continuously waiting for some client to appear (the &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method returns only after it catches a client, or something bad happens).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Type something in the output window of the Client and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Look to the other tab and see that the Sever outputs the message you have just typed. Try with other messages. To close the Client, type &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Depending on how you have written the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;Server&amp;#039;&amp;#039;&amp;#039; class, the server will end too, or it will continue, listening for other clients to connect (in case &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;which &lt;/del&gt;you run again the Client.java, type something a.s.o)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Type something in the output window of the Client and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Look to the other tab and see that the Sever outputs the message you have just typed. Try with other messages. To close the Client, type &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Depending on how you have written the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;Server&amp;#039;&amp;#039;&amp;#039; class, the server will end too, or it will continue, listening for other clients to connect (in &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;which &lt;/ins&gt;case you run again the Client.java, type something a.s.o)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you want more fun, and know the IP address of the computer of your colleague, ask him to open a server, change your &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; class to open a Socket with that IP instead of the localhost IP 127.0.0.1, and run locally a client. Please, send only peacefull messages!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you want more fun, and know the IP address of the computer of your colleague, ask him to open a server, change your &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; class to open a Socket with that IP instead of the localhost IP 127.0.0.1, and run locally a client. Please, send only peacefull messages!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5030&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5030&amp;oldid=prev"/>
		<updated>2016-12-22T01:05:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 01:05&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l61&quot; &gt;Linia 61:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 61:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the Server class (with the Server.java opened in the editor window right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or click &amp;#039;&amp;#039;Run&amp;#039;&amp;#039;-&amp;gt;&amp;#039;&amp;#039;Run File&amp;#039;&amp;#039; from the general Menu). If there are no errors the program runs, but nothing is output, and it appears to run without end. It&amp;#039;s because there are no clients running around and it listens continuously waiting for some client to appear (the &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method returns only after it catches a client, or something bad happens).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the Server class (with the Server.java opened in the editor window right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or click &amp;#039;&amp;#039;Run&amp;#039;&amp;#039;-&amp;gt;&amp;#039;&amp;#039;Run File&amp;#039;&amp;#039; from the general Menu). If there are no errors the program runs, but nothing is output, and it appears to run without end. It&amp;#039;s because there are no clients running around and it listens continuously waiting for some client to appear (the &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method returns only after it catches a client, or something bad happens).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Type something in the output window of the Client and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Look to the other tab and see that the Sever outputs the message you have just typed. Try with other messages. To close the Client, type &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Depending on how you have written the &amp;#039;&amp;#039;&amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;main&lt;/del&gt;&amp;#039;&amp;#039;&amp;#039; of the &amp;#039;&amp;#039;&amp;#039;Server&amp;#039;&amp;#039;&amp;#039; class, the server will end too, or it will continue, listening for other clients to connect (in case which you run again the Client.java, type something a.s.o)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Type something in the output window of the Client and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Look to the other tab and see that the Sever outputs the message you have just typed. Try with other messages. To close the Client, type &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; and press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;. Depending on how you have written the &amp;#039;&amp;#039;&amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;run&lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method &lt;/ins&gt;of the &amp;#039;&amp;#039;&amp;#039;Server&amp;#039;&amp;#039;&amp;#039; class, the server will end too, or it will continue, listening for other clients to connect (in case which you run again the Client.java, type something a.s.o)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you want more fun, and know the IP address of the computer of your colleague, ask him to open a server, change your &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; class to open a Socket with that IP instead of the localhost IP 127.0.0.1, and run locally a client. Please, send only peacefull messages!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# If you want more fun, and know the IP address of the computer of your colleague, ask him to open a server, change your &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; class to open a Socket with that IP instead of the localhost IP 127.0.0.1, and run locally a client. Please, send only peacefull messages!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5029&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5029&amp;oldid=prev"/>
		<updated>2016-12-22T01:05:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 01:05&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l48&quot; &gt;Linia 48:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 48:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** As long as the connection is open, the &amp;#039;&amp;#039;&amp;#039;readObject method&amp;#039;&amp;#039;&amp;#039; waits for a complete object to be received from the stream and then returns with a reference to it. If the connection is closed (by the other side for example) the method aborts and throws the &amp;#039;&amp;#039;&amp;#039;EOFException&amp;#039;&amp;#039;&amp;#039;. Use this exception to neatly end the read loop. For this purpose, enclose the continuous loop in a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block and attach a &amp;#039;&amp;#039;&amp;#039;catch&amp;#039;&amp;#039;&amp;#039; for this particular exception, whithout statements. This catch will simply serve to continue the program, instead of aborting it with an exception. If you want a more realistic output, you may print on the screen, after the &amp;#039;&amp;#039;&amp;#039;EOFException&amp;#039;&amp;#039;&amp;#039; was caught, the message &amp;#039;&amp;#039;The client has disconnected.&amp;#039;&amp;#039; or something like that.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** As long as the connection is open, the &amp;#039;&amp;#039;&amp;#039;readObject method&amp;#039;&amp;#039;&amp;#039; waits for a complete object to be received from the stream and then returns with a reference to it. If the connection is closed (by the other side for example) the method aborts and throws the &amp;#039;&amp;#039;&amp;#039;EOFException&amp;#039;&amp;#039;&amp;#039;. Use this exception to neatly end the read loop. For this purpose, enclose the continuous loop in a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block and attach a &amp;#039;&amp;#039;&amp;#039;catch&amp;#039;&amp;#039;&amp;#039; for this particular exception, whithout statements. This catch will simply serve to continue the program, instead of aborting it with an exception. If you want a more realistic output, you may print on the screen, after the &amp;#039;&amp;#039;&amp;#039;EOFException&amp;#039;&amp;#039;&amp;#039; was caught, the message &amp;#039;&amp;#039;The client has disconnected.&amp;#039;&amp;#039; or something like that.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** Don&amp;#039;t forget to close everything after the connection is closed (and you exited from the loop). You have just added a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block, so you need only to attach to it the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block with statements to close the input stream and the socket. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared ouside the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** Don&amp;#039;t forget to close everything after the connection is closed (and you exited from the loop). You have just added a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block, so you need only to attach to it the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block with statements to close the input stream and the socket. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared ouside the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The last to be added to your package is a class called &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Server&amp;lt;/code&amp;gt;, which is executable (has a main method).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# The last to be added to your package is a class called &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Server&amp;lt;/code&amp;gt;, which is executable (has a main method). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;It encloses:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The main method &lt;/del&gt;instantiates a &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039; object &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;attached to &lt;/del&gt;port &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;9000&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;One constructor, with a single argument which is the public port number of your server. This constructor &lt;/ins&gt;instantiates a &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039; object &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;connected the given &lt;/ins&gt;port.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039; method &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is used &lt;/del&gt;to listen for clients. This method returns after a client request is accepted and a connection with that client is established. The method returns a reference to a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object created &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;specially &lt;/del&gt;for this connection. You use this &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; reference to instantiate a &amp;#039;&amp;#039;&amp;#039;ServerPeer&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* The &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;reference must be an instance field, so that it may be used by the other methods of this class.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Call then &lt;/del&gt;the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method for this newly created &amp;#039;&amp;#039;&amp;#039;ServerPeer&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;#* A method, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;void run()&amp;lt;/code&amp;gt;, without arguments, which:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The &lt;/del&gt;method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;returns &lt;/del&gt;after the connection is closed (remember, you just added the proper &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039;-&amp;#039;&amp;#039;&amp;#039;catch&amp;#039;&amp;#039;&amp;#039; construction to handle the &amp;#039;&amp;#039;&amp;#039;EOFException&amp;#039;&amp;#039;&amp;#039;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The &lt;/del&gt;&amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is closed&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;but not &lt;/del&gt;the &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. You &lt;/del&gt;may call again &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/del&gt;&amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;accept &lt;/del&gt;another client, a.s.o.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;#** calls the &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039;&amp;#039;s &lt;/ins&gt;method &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/ins&gt;to listen for clients. This method returns after a client request is accepted and a connection with that client is established. The method returns a reference to a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;local &lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object created &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;specifically &lt;/ins&gt;for this connection. You use this &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; reference to instantiate a &amp;#039;&amp;#039;&amp;#039;ServerPeer&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Don&amp;#039;t forget to close the &amp;#039;&amp;#039;&amp;#039;SeverSocket&amp;#039;&amp;#039;&amp;#039; object after you decide to no longer accept clients and to exit your program.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#*&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* calls next &lt;/ins&gt;the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method for this newly created &amp;#039;&amp;#039;&amp;#039;ServerPeer&amp;#039;&amp;#039;&amp;#039; object.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* If it still has compilation errors it&amp;#039;s because you forget about that annoying exceptions. The &amp;#039;&amp;#039;&amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;main&lt;/del&gt;&amp;#039;&amp;#039;&amp;#039; method uses various sockets and streams, that may throw exceptions ... already a classic story. Don&amp;#039;t bother with them, simply append the necessary declaration to the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method signature. In addition to &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;s, a &amp;#039;&amp;#039;&amp;#039;ClassNotFoundException&amp;#039;&amp;#039;&amp;#039; may be thrown from &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039;, so it needs to be declared too.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#*&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* both the &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; &lt;/ins&gt;method &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and the &lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method of the &amp;#039;&amp;#039;&amp;#039;ServerPeer&amp;#039;&amp;#039;&amp;#039; may generate exceptions. You do not handle them, but they must be declared as thrown by the method.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;#** it must return only &lt;/ins&gt;after the connection is closed (remember, you just added the proper &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039;-&amp;#039;&amp;#039;&amp;#039;catch&amp;#039;&amp;#039;&amp;#039; construction to handle the &amp;#039;&amp;#039;&amp;#039;EOFException&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#039;&amp;#039;&amp;#039; for the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;ServerPeer&lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;It closes only the &lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;object. However&lt;/ins&gt;, the &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is up and you &lt;/ins&gt;may call again &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;its &lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;connect to &lt;/ins&gt;another client, a.s.o.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/ins&gt;* Don&amp;#039;t forget to close the &amp;#039;&amp;#039;&amp;#039;SeverSocket&amp;#039;&amp;#039;&amp;#039; object after you decide to no longer accept clients and to exit your program&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. Use the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039;/&amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; blocks to be sure that the &amp;#039;&amp;#039;&amp;#039;ServerSocket&amp;#039;&amp;#039;&amp;#039; will be always closed&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* If it still has compilation errors it&amp;#039;s because you forget about that annoying exceptions. The &amp;#039;&amp;#039;&amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;run&lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039; method uses various sockets and streams, that may throw exceptions ... already a classic story. Don&amp;#039;t bother with them, simply append the necessary declaration to the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method signature. In addition to &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;s, a &amp;#039;&amp;#039;&amp;#039;ClassNotFoundException&amp;#039;&amp;#039;&amp;#039; may be thrown from &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039;, so it needs to be declared too&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, or you declare their base class of exceptions to be thrown.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;#* The main method instantiates a &amp;#039;&amp;#039;&amp;#039;Server&amp;#039;&amp;#039;&amp;#039; object attached to some port (for example 9000), and calls its &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the Server class (with the Server.java opened in the editor window right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or click &amp;#039;&amp;#039;Run&amp;#039;&amp;#039;-&amp;gt;&amp;#039;&amp;#039;Run File&amp;#039;&amp;#039; from the general Menu). If there are no errors the program runs, but nothing is output, and it appears to run without end. It&amp;#039;s because there are no clients running around and it listens continuously waiting for some client to appear (the &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method returns only after it catches a client, or something bad happens).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Run the Server class (with the Server.java opened in the editor window right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or click &amp;#039;&amp;#039;Run&amp;#039;&amp;#039;-&amp;gt;&amp;#039;&amp;#039;Run File&amp;#039;&amp;#039; from the general Menu). If there are no errors the program runs, but nothing is output, and it appears to run without end. It&amp;#039;s because there are no clients running around and it listens continuously waiting for some client to appear (the &amp;#039;&amp;#039;&amp;#039;accept&amp;#039;&amp;#039;&amp;#039; method returns only after it catches a client, or something bad happens).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# How to test your classes? Actually you have two separate applications, a server and a client. You have just started the server, but it runs without end waiting for a client to send messages. You need to start separately a client. To do that, switch the editor window to Client.java and run that file too (right-click and select &amp;#039;&amp;#039;Run File&amp;#039;&amp;#039;, or bla bla). A second output tab appears. You have now two programs running at the same time, with their outputs displayed on separate tabs in the output window at the bottom of the NetBeans environment.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5028&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5028&amp;oldid=prev"/>
		<updated>2016-12-22T00:38:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 00:38&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l26&quot; &gt;Linia 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# All fields must be private.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# All fields must be private.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method). This class has&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method). This class has&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A constructor, with two arguments, a string for an internet address, and an integer for a port number. This constructor creates a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object and connects it to the desired remote socket,&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A constructor, with two arguments, a string for an internet address, and an integer for a port number. This constructor creates a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object and connects it to the desired remote socket, whose address and port are given as arguments.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;whose address and port are given as arguments.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;run&amp;lt;/code&amp;gt;, without arguments, which does the following:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;run&amp;lt;/code&amp;gt;, without arguments, which does the following:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* First, it instantiates a &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object with your name as an argument (you are the sender!) and the reference to the &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object as the other argument.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* First, it instantiates a &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object with your name as an argument (you are the sender!) and the reference to the &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object as the other argument.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5027&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5027&amp;oldid=prev"/>
		<updated>2016-12-22T00:37:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 00:37&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l25&quot; &gt;Linia 25:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 25:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The constructor and both methods employ a socket and a stream, whose methods may throw various exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039; when called. You do not catch them, but, because they are checked exceptions, you must declare them to be thrown by the constructor and the methods.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The constructor and both methods employ a socket and a stream, whose methods may throw various exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039; when called. You do not catch them, but, because they are checked exceptions, you must declare them to be thrown by the constructor and the methods.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# All fields must be private.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# All fields must be private.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;your project &lt;/del&gt;another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package &lt;/ins&gt;another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;This class has&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;First&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates &lt;/del&gt;a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;with the destination IP address 127.0.0.1 &lt;/del&gt;and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;port 9000 (that &lt;/del&gt;connects &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the client&amp;#039;s socket &lt;/del&gt;to the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;destination&amp;#039;s &lt;/del&gt;socket, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the localhost (127.0.0.1) on &lt;/del&gt;port &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;9000)&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;A constructor, with two arguments, a string for an internet address&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and an integer for a port number. This constructor creates &lt;/ins&gt;a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object and connects &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;it &lt;/ins&gt;to the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;desired remote &lt;/ins&gt;socket,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Then&lt;/del&gt;, it instantiates a &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object with your name as an argument (you are the sender!) and the reference to the &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;you have just instantiated &lt;/del&gt;as the other argument.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;whose address and &lt;/ins&gt;port &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;are given as arguments&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Third&lt;/del&gt;, open an input stream of characters to read from the keyboard. The input stream from the keyboard is already enclosed in the object &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039;, which is opened and available by default. However, this stream is a byte stream, therefore you need to filter it properly, so that the bytes are transformed to characters. To do that, you enclose the &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039; stream into an &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;InputStreamReader&amp;lt;/code&amp;gt; object. The &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039; object (&amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; is derived from &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039;) delivers the stream character by character. To read a whole line from the keyboard without calling the &amp;#039;&amp;#039;&amp;#039;read&amp;#039;&amp;#039;&amp;#039; method for each character, you enclose further the &amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; into a &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;BufferedReader&amp;lt;/code&amp;gt; object, whose &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method fits this purpose. The &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method returns (with a string) only after you type the &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; key (but the newline character will not be part of the returned string).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;run&amp;lt;/code&amp;gt;, without arguments, which does the following:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;#* First&lt;/ins&gt;, it instantiates a &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object with your name as an argument (you are the sender!) and the reference to the &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object as the other argument.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;After that&lt;/ins&gt;, open an input stream of characters to read from the keyboard. The input stream from the keyboard is already enclosed in the object &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039;, which is opened and available by default. However, this stream is a byte stream, therefore you need to filter it properly, so that the bytes are transformed to characters. To do that, you enclose the &amp;#039;&amp;#039;&amp;#039;System.in&amp;#039;&amp;#039;&amp;#039; stream into an &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;InputStreamReader&amp;lt;/code&amp;gt; object. The &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039; object (&amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; is derived from &amp;#039;&amp;#039;&amp;#039;Reader&amp;#039;&amp;#039;&amp;#039;) delivers the stream character by character. To read a whole line from the keyboard without calling the &amp;#039;&amp;#039;&amp;#039;read&amp;#039;&amp;#039;&amp;#039; method for each character, you enclose further the &amp;#039;&amp;#039;&amp;#039;InputStreamReader&amp;#039;&amp;#039;&amp;#039; into a &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;BufferedReader&amp;lt;/code&amp;gt; object, whose &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method fits this purpose. The &amp;#039;&amp;#039;&amp;#039;readLine&amp;#039;&amp;#039;&amp;#039; method returns (with a string) only after you type the &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; key (but the newline character will not be part of the returned string).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Then, read a string of characters from the keyboard (from the previously opened input stream) and call the &amp;#039;&amp;#039;&amp;#039;sendMessage&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object. Your typed messages will thus be sent to the destination.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Then, read a string of characters from the keyboard (from the previously opened input stream) and call the &amp;#039;&amp;#039;&amp;#039;sendMessage&amp;#039;&amp;#039;&amp;#039; method of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object. Your typed messages will thus be sent to the destination.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* You may send messages in a continuous loop (type a line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;, type another line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; a.s.o).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* You may send messages in a continuous loop (type a line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;, type another line, press &amp;#039;&amp;#039;Enter&amp;#039;&amp;#039; a.s.o).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* To break the loop, you test for a special typed line, &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; (it will act like a command, not a message to be sent). Remember how to check that two strings are equal!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* To break the loop, you test for a special typed line, &amp;#039;&amp;#039;QUIT&amp;#039;&amp;#039; (it will act like a command, not a message to be sent). Remember how to check that two strings are equal!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* After you finish with sending messages don&amp;#039;t forget to close the output stream of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object, the input stream and the socket! To be sure that they are closed in any circumstances, put the statements that closes them in a &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block, atached to a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block that encloses the other part of the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ouside &lt;/del&gt;the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* After you finish with sending messages don&amp;#039;t forget to close the output stream of the &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; object, the input stream and the socket! To be sure that they are closed in any circumstances, put the statements that closes them in a &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block, atached to a &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block that encloses the other part of the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method. Be careful, the references used inside the &amp;#039;&amp;#039;&amp;#039;finally&amp;#039;&amp;#039;&amp;#039; block must be declared &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;outside &lt;/ins&gt;the &amp;#039;&amp;#039;&amp;#039;try&amp;#039;&amp;#039;&amp;#039; block &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and initialized with some value (the initialization value may be null).&lt;/ins&gt;!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Because the &amp;#039;&amp;#039;&amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;main&lt;/del&gt;&amp;#039;&amp;#039;&amp;#039; method operates with sockets and streams it may also &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;run into &lt;/del&gt;checked exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;. You do not catch them; simply declare that the method &amp;#039;&amp;#039;&amp;#039;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;main&lt;/del&gt;&amp;#039;&amp;#039;&amp;#039; throws them out.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Because the &amp;#039;&amp;#039;&amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;run&lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039; method operates with sockets and streams it may also &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;raise &lt;/ins&gt;checked exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039;. You do not catch them; simply declare that the method &amp;#039;&amp;#039;&amp;#039;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;run&lt;/ins&gt;&amp;#039;&amp;#039;&amp;#039; throws them out&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# You may run this file, to see that it compiles, builds and runs, but the execution will end abruptly with an exception because there is still no server running to which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/del&gt;client might connect (Connection refused). The following steps are devoted to the other part of the connection, the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;peer application&lt;/del&gt;, the server.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;# The &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates a &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object with some destination IP address (try first with 127.0.0.1), and port 9000 (that connects the client&amp;#039;s socket to the destination&amp;#039;s socket, the localhost (127.0.0.1) on port 9000), and calls the method &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; for the newly created &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; object.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Implement &lt;/del&gt;a class called &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ServerPeer&amp;lt;/code&amp;gt; with the following features:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;#* Because both the &amp;#039;&amp;#039;&amp;#039;Client&amp;#039;&amp;#039;&amp;#039; constructor and the &amp;#039;&amp;#039;&amp;#039;run&amp;#039;&amp;#039;&amp;#039; method may generate checked exceptions, throw them further outside the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# You may run this file, to see that it compiles, builds and runs, but the execution will end abruptly with an exception because there is still no server running&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/ins&gt;to which &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;your &lt;/ins&gt;client might connect (Connection refused). The following steps are devoted to the other part of the connection, the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;receiver of messages&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;which also acts as &lt;/ins&gt;the server.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Add to the &amp;#039;&amp;#039;&amp;#039;labutil&amp;#039;&amp;#039;&amp;#039; package &lt;/ins&gt;a class called &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ServerPeer&amp;lt;/code&amp;gt; with the following features:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The constructor has as its sole argument a reference to a pre-initialized &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object, that it stores in a private field.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The constructor has as its sole argument a reference to a pre-initialized &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object, that it stores in a private field.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;void run()&amp;lt;/code&amp;gt; opens an input stream for this socket, reads messages from it, and displays them on the screen, formatted as specified in OOP Lab Task 1.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;void run()&amp;lt;/code&amp;gt; opens an input stream for this socket, reads messages from it, and displays them on the screen, formatted as specified in OOP Lab Task 1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5026&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5026&amp;oldid=prev"/>
		<updated>2016-12-22T00:17:20Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 00:17&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l22&quot; &gt;Linia 22:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** The object is sent through the output stream of the Socket. You get the reference to that stream using the Socket&amp;#039;s method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;getOutputStream&amp;lt;/code&amp;gt;, but to be able to send objects through this stream, which is only a basic stream of bytes, you need to enclose it in a filter stream of type &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ObjectOutputStream&amp;lt;/code&amp;gt; (this object does the serialization for you, that is it converts the &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object into a stream of bytes).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** The object is sent through the output stream of the Socket. You get the reference to that stream using the Socket&amp;#039;s method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;getOutputStream&amp;lt;/code&amp;gt;, but to be able to send objects through this stream, which is only a basic stream of bytes, you need to enclose it in a filter stream of type &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ObjectOutputStream&amp;lt;/code&amp;gt; (this object does the serialization for you, that is it converts the &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object into a stream of bytes).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;close&amp;lt;/code&amp;gt;, without arguments and return values, that symply closes the output stream.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;close&amp;lt;/code&amp;gt;, without arguments and return values, that symply closes the output stream.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/del&gt;* The output stream is created at &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; instantiation, used by &amp;#039;&amp;#039;&amp;#039;sendMessage&amp;#039;&amp;#039;&amp;#039; method which writes &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; objects into, and closed by &amp;#039;&amp;#039;&amp;#039;close&amp;#039;&amp;#039;&amp;#039; method.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The output stream is created at &amp;#039;&amp;#039;&amp;#039;ClientPeer&amp;#039;&amp;#039;&amp;#039; instantiation, used by &amp;#039;&amp;#039;&amp;#039;sendMessage&amp;#039;&amp;#039;&amp;#039; method which writes &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; objects into, and closed by &amp;#039;&amp;#039;&amp;#039;close&amp;#039;&amp;#039;&amp;#039; method.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;*&lt;/del&gt;* The constructor and both methods employ a socket and a stream, whose methods may throw various exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039; when called. You do not catch them, but, because they are checked exceptions, you must declare them to be thrown by the constructor and the methods.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* The constructor and both methods employ a socket and a stream, whose methods may throw various exceptions of type &amp;#039;&amp;#039;&amp;#039;IOException&amp;#039;&amp;#039;&amp;#039; when called. You do not catch them, but, because they are checked exceptions, you must declare them to be thrown by the constructor and the methods.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/del&gt;All fields must be private.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# All fields must be private.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to your project another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Add to your project another class, named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;Client&amp;lt;/code&amp;gt;, which is executable (has a &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* First, the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object with the destination IP address 127.0.0.1 and port 9000 (that connects the client&amp;#039;s socket to the destination&amp;#039;s socket, the localhost (127.0.0.1) on port 9000).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* First, the &amp;#039;&amp;#039;&amp;#039;main&amp;#039;&amp;#039;&amp;#039; method instantiates a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object with the destination IP address 127.0.0.1 and port 9000 (that connects the client&amp;#039;s socket to the destination&amp;#039;s socket, the localhost (127.0.0.1) on port 9000).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
	<entry>
		<id>http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5025&amp;oldid=prev</id>
		<title>Zhascsi: /* Requirements */</title>
		<link rel="alternate" type="text/html" href="http://wiki.dcae.pub.ro/index.php?title=OOP_Lab_Task_5&amp;diff=5025&amp;oldid=prev"/>
		<updated>2016-12-22T00:14:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Requirements&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ro&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Versiunea anterioară&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Versiunea de la data 22 decembrie 2016 00:14&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l19&quot; &gt;Linia 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Only one constructor, that takes as arguments a string (the user/sender name) and a reference to a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object, that is supposed to be already instantiated and connected, and saves them in private fields.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* Only one constructor, that takes as arguments a string (the user/sender name) and a reference to a &amp;#039;&amp;#039;&amp;#039;Socket&amp;#039;&amp;#039;&amp;#039; object, that is supposed to be already instantiated and connected, and saves them in private fields.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;void sendMessage(String message)&amp;lt;/code&amp;gt;, that creates a &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object with the content taken from the method&amp;#039;s argument and the sender&amp;#039;s name read from the class&amp;#039; fields, and sends the newly created object through the available Socket.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;void sendMessage(String message)&amp;lt;/code&amp;gt;, that creates a &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object with the content taken from the method&amp;#039;s argument and the sender&amp;#039;s name read from the class&amp;#039; fields, and sends the newly created object through the available Socket.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** In order to be able to send a &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object through a stream (to serialize that object), &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;it &lt;/del&gt;must be serializable.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** In order to be able to send a &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object through a stream (to serialize that object), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that object &lt;/ins&gt;must be serializable.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** The object is sent through the output stream of the Socket. You get the reference to that stream using the Socket&amp;#039;s method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;getOutputStream&amp;lt;/code&amp;gt;, but to be able to send objects through this stream, which is only a basic stream of bytes, you need to enclose it in a filter stream of type &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ObjectOutputStream&amp;lt;/code&amp;gt; (this object does the serialization for you, that is it converts the &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object into a stream of bytes).&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** The object is sent through the output stream of the Socket. You get the reference to that stream using the Socket&amp;#039;s method &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;getOutputStream&amp;lt;/code&amp;gt;, but to be able to send objects through this stream, which is only a basic stream of bytes, you need to enclose it in a filter stream of type &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;ObjectOutputStream&amp;lt;/code&amp;gt; (this object does the serialization for you, that is it converts the &amp;#039;&amp;#039;&amp;#039;Message&amp;#039;&amp;#039;&amp;#039; object into a stream of bytes).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;close&amp;lt;/code&amp;gt;, without arguments and return values, that symply closes the output stream.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* A method named &amp;lt;code style=&amp;quot;color:green;&amp;quot;&amp;gt;close&amp;lt;/code&amp;gt;, without arguments and return values, that symply closes the output stream.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhascsi</name></author>
	</entry>
</feed>