title: Socket vs SocketChannel
body: <p>I am trying to understand <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/nio/channels/SocketChannel.html" rel="noreferrer">SocketChannels</a>, and <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/package-summary.html" rel="noreferrer">NIO</a> in general. I know how to work with regular sockets and how to make a simple thread-per-client server (using the regular blocking sockets). </p>
  
  <p>So my questions:</p>
  
  <ul>
  <li>What is a SocketChannel?</li>
  <li>What is the extra I get when working with a SocketChannel instead of a Socket.</li>
  <li>What is the relationship between a channel and a buffer?</li>
  <li>What is a selector?</li>
  <li>The first sentance in the <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/channels/SocketChannel.html" rel="noreferrer">documentation</a> is <code>A selectable channel for stream-oriented connecting sockets.</code>. What does that mean?</li>
  </ul>
  
  <p>I have read the also <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/package-summary.html" rel="noreferrer">this documentation</a>, but somehow I am not getting it...</p>