title: Is the new connected socket returned by accept() always bound to the same port as the listening socket?
body: <p>I tested this on my machine by creating new connections until failure. On my machine new <code>connect()</code>/<code>accept()</code> requests fail* at near 700 socket connections (SOCK_STREAM); at the client/server respectively, on the loopback IP address. However the socket file descriptor returned by accept(), so far, is always bound to the same port as the listening socket.</p>
  
  <p>My question is - If this behaviour is true for all machines then why is <code>accept()</code> limiting connections by creating connected sockets bound only to the same port as the listening socket? Couldn't the number of connections the server can make be increased greatly if the new sockets were bound to random ports (like <code>connect()</code> does)?</p>
  
  <p>Also, why is <code>accept(sock_fd, NULL, NULL)</code> failing with <em>"EFAULT - The addr argument is not in a writable part of the user address space."</em> after nearly 700 successful iterations of the same call? </p>
  
  <p>Similarly, why does, <code>connect()</code> fail with <em>"EFAULT - The socket structure address is outside the user's address space."</em> after nearly 700 successful iterations of the same call?</p>
  
  <p>* EFAULT - Bad Address (after both accept()/connect()).</p>