<div dir="ltr"><div><div><div><div><div>When a socket is closed at one side of the communication, the other side will not get to know this information.<br></div>In
 your case, when ctrl+c is performed, socket is terminated abruptly at 
host1 end. Until, host2 tries to read from this broken connection, host 2
 will not know that the connection is broken  and it will keep the same 
conn alive. The moment, host2 tries to read from this socket, it will 
come to know that the connection is broken and it will terminate the 
connection. The logical flow of function(system calls) at host2 would be<br><br></div>read() -&gt; Application would receive an error on read call<br></div>shutdown() -&gt;depends on the application you are using<br></div>close()<br><br></div><div>Then depending on the application, if it decides to terminate, it will call exit() as well.<br><br></div>you can see the man pages of these commands for more information.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 7, 2014 at 2:37 AM, Grzegorz Dwornicki <span dir="ltr">&lt;<a href="mailto:gd1100@gmail.com" target="_blank">gd1100@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I have a big interest in how kernel handles this situaction.<br>
<br>
Lets assume that we have two hosts: host 1 and host 2 and on host 1 I<br>
have started this command:<br>
nc -l -p 4444<br>
on host 2 I have started this command (2 means IP addres of second host here!):<br>
nc 2 4444<br>
<br>
Now i can send msgs betweem them. In time I have decided to end<br>
connection. To do this I&#39;m using ctrl+c on host 2. What functions are<br>
called to clean broken socket on host 1? What functions are called to<br>
clean up socket on host 2?<br>
<br>
Grzegorz.<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><span style="font-family:comic sans ms,sans-serif;color:rgb(102,102,102)">Regards,</span><br style="font-family:comic sans ms,sans-serif;color:rgb(102,102,102)"><span style="font-family:comic sans ms,sans-serif;color:rgb(102,102,102)">Sreejith</span><br><span style="color:rgb(192,192,192)">--------------------------------------------------------------------------------------------------------</span><br><font size="1"><span style="color:rgb(192,192,192);font-family:comic sans ms,sans-serif">Aint no grave, can hold <span style="color:rgb(255,0,0)">my </span>body down</span><span style="font-family:comic sans ms,sans-serif">!!!   </span></font><br><div><font face="comic sans ms, sans-serif"><font color="#cccccc">&quot;Obadiah</font><font color="#ff0000"> 1:4&quot;</font></font></div></div>
</div>