title: Socket programming - What's the difference between listen() and accept()?
body: <p>I've been reading <a href="http://www.cs.rpi.edu/~moorthy/Courses/os98/Pgms/socket.html" rel="noreferrer">this tutorial</a> to learn about socket programming.  It seems that the <code>listen()</code> and <code>accept()</code> system calls both do the same thing, which is block and wait for a client to connect to the socket that was created with the <code>socket()</code> system call.  Why do you need two separate steps for this?  Why not just use one system call?</p>
  
  <p>By the way, I have googled this question and found similar questions, but none of the answers were satisfactory.  For example, one of them said that <code>accept()</code> creates the socket, which makes no sense, since I know that the socket is created by <code>socket()</code>.</p>