title: What is the difference between type and protocol in c socket() function?
body: <p>I'm reading and trying to get an idea of <code>C</code>, and I tried to program a <code>Java chat</code> with <code>UDP</code> and <code>TCP</code> a couple of years back, and as much as I pulled it off... I could not do it.
  I want to program sockets and I'm reading tons of documentation, but there is always a part that is unclear, every kicking documentation has a flaw.
  For example, there is one about </p>
  
  <pre><code>int socket(int domain, int type, int protocol);
  </code></pre>
  
  <p>The domain I will use is clearly <code>AF_INET</code>, and if I want a <code>TCP</code> Socket I think type should be <code>SOCK_STREAM</code>, but what is protocol? Documentation says it should be 0... why??? what is it?</p>