<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="et">
	<id>http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=Network_Sockets_%28ITS8020%29</id>
	<title>Network Sockets (ITS8020) - Redigeerimiste ajalugu</title>
	<link rel="self" type="application/atom+xml" href="http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=Network_Sockets_%28ITS8020%29"/>
	<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=Network_Sockets_(ITS8020)&amp;action=history"/>
	<updated>2026-04-07T00:10:32Z</updated>
	<subtitle>Selle lehekülje redigeerimiste ajalugu</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://courses.cs.taltech.ee/w/index.php?title=Network_Sockets_(ITS8020)&amp;diff=7757&amp;oldid=prev</id>
		<title>Irve: /* Connection */</title>
		<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=Network_Sockets_(ITS8020)&amp;diff=7757&amp;oldid=prev"/>
		<updated>2018-11-16T09:42:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Connection&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;et&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←Vanem redaktsioon&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Redaktsioon: 16. november 2018, kell 09:42&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-l12&quot; &gt;12. rida:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;12. rida:&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;  connect www.lambda.ee 80&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;  connect www.lambda.ee 80&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;would connect to www.lambda.ee on port 80. Write&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;would connect to www.lambda.ee on port 80. Write&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;  &amp;lt;nowiki&amp;gt;GET &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;http://courses.cs.ttu.ee/pages/Esileht&lt;/del&gt;/ HTTP/1.0\r\n\r\n&amp;lt;/nowiki&amp;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;  &amp;lt;nowiki&amp;gt;GET / HTTP/1.0\r\n\r\n&amp;lt;/nowiki&amp;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;to the socket and display any resulting data on screen. Terminate when connection is closed.&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 the socket and display any resulting data on screen. Terminate when connection is closed.&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>Irve</name></author>
	</entry>
	<entry>
		<id>http://courses.cs.taltech.ee/w/index.php?title=Network_Sockets_(ITS8020)&amp;diff=7756&amp;oldid=prev</id>
		<title>Irve: Uus lehekülg: &#039;&#039;&#039;The goal is to try sending and receiving data over the socket interface&#039;&#039;  You will use socket(), connect(), bind(), listen(), accept() and socket addresses for the task.  ==Ta...&#039;</title>
		<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=Network_Sockets_(ITS8020)&amp;diff=7756&amp;oldid=prev"/>
		<updated>2018-11-16T09:39:32Z</updated>

		<summary type="html">&lt;p&gt;Uus lehekülg: &amp;#039;&amp;#039;&amp;#039;The goal is to try sending and receiving data over the socket interface&amp;#039;&amp;#039;  You will use socket(), connect(), bind(), listen(), accept() and socket addresses for the task.  ==Ta...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Uus lehekülg&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;The goal is to try sending and receiving data over the socket interface&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You will use socket(), connect(), bind(), listen(), accept() and socket addresses for the task.&lt;br /&gt;
&lt;br /&gt;
==Task==&lt;br /&gt;
&lt;br /&gt;
There are two separate tasks.&lt;br /&gt;
&lt;br /&gt;
=== Connection ===&lt;br /&gt;
&lt;br /&gt;
Write a program which tries connecting to a specified machine on specified port so the following command:&lt;br /&gt;
 connect www.lambda.ee 80&lt;br /&gt;
would connect to www.lambda.ee on port 80. Write&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;GET http://courses.cs.ttu.ee/pages/Esileht/ HTTP/1.0\r\n\r\n&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
to the socket and display any resulting data on screen. Terminate when connection is closed.&lt;br /&gt;
&lt;br /&gt;
=== Listening ===&lt;br /&gt;
&lt;br /&gt;
Write a server program which shows on screen whatever data is received from the network. The command line:&lt;br /&gt;
 listen 3333&lt;br /&gt;
would listen on port 3333 and display any received connections.&lt;br /&gt;
&lt;br /&gt;
When connection is made, display the address of the other connection, then display the data until connection is closed.&lt;br /&gt;
&lt;br /&gt;
== Bonus ==&lt;br /&gt;
&lt;br /&gt;
If the former part of the exercises does not provide you with sufficient brain-stimulation. Please try the following: Create a program which outputs the output of &amp;quot;ls -l&amp;quot; to the network on the given socket  when connected; using dup() or dup2() functions. For running a progam you could use fork() and execv(). It could work as follows:&lt;br /&gt;
 lsner 3333&lt;br /&gt;
&lt;br /&gt;
And then you could try it out using netcat for example.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
Use netcat for connecting and listening to your program:&lt;br /&gt;
 nc www.lambda.ee 80&lt;br /&gt;
 nc -l 8080&lt;br /&gt;
&lt;br /&gt;
Note that you can only listen to ports starting from 1024. In addition to that, the Dijkstra server has an external firewall which prevents connections from &amp;#039;&amp;#039;&amp;#039;outside&amp;#039;&amp;#039;&amp;#039; unless you listen on ports 7400-8000 .&lt;/div&gt;</summary>
		<author><name>Irve</name></author>
	</entry>
</feed>