title: socket listen and accept in C programme language
body: <p>Here my socket.c as server simply listen on a port: 
  the succinct code like below, I just want the code listening but not exit the process.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #include &lt;netdb.h&gt;
  #include &lt;netinet/in.h&gt;
  #include &lt;arpa/inet.h&gt;
  
  #include &lt;string.h&gt;
  
  #define DEFAULT_PORT 27015
  
  int main(int argc, char *argv[]) {
  
      int so = socket(0,1,0);
  
      struct sockaddr_in serv_addr, cli_addr;
  
      bzero(&amp;serv_addr,sizeof(serv_addr));
  
      serv_addr.sin_family = AF_INET;
      serv_addr.sin_addr.s_addr = INADDR_ANY;
      serv_addr.sin_port = htons(DEFAULT_PORT);
  
      listen(so,5);
  
      accept(so,NULL,NULL);
  
  
      return 0;
  
  }
  </code></pre>
  
  <p>absolutely some hard code in here.
  but when I gcc a.c compile it and run it. it will exit rather than listening.</p>
  
  <p>So what's wrong with my code ????????????</p>