title: Sockets in Linux - serv_addr.sin_addr.s_addr = INADDR_ANY;
body: <p>I am doing Socket Programming in Linux. Had a question.
  How is it possible for us to allow specific IP addresses to connect to our <strong>server</strong>. </p>
  
  <p>For instance:</p>
  
  <ul>
  <li>Allow 10.0.0.1</li>
  <li>Deny 10.0.0.1</li>
  </ul>
  
  <p>I am specifically talking about this Line of Code where we fill <strong>INADDR_ANY</strong> to our <strong>sockaddr_in struct</strong></p>
  
  <pre><code>serv_addr.sin_addr.s_addr = INADDR_ANY;
  </code></pre>
  
  <p>Rest of the Code just for Reference:</p>
  
  <pre><code>struct sockaddr_in serv_addr;
  
  
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_addr.s_addr = INADDR_ANY; // Here's my question!!
  serv_addr.sin_port = htons(portno);
  </code></pre>