title: recvfrom() not blocking
body: <p>For some reason my recvfrom() function for sockets is not blocking on my server code like it is supposed to.  I am making a basic UDP server to create a rolling session key system.</p>
  
  <p>What am I doing wrong here?  It continues on after this line (before i put the (n &lt; 1)) and was crashing.  I am pretty sure recvfrom() is supposed to stop the execution of the program until it gets something from the client...</p>
  
  <pre><code>    int sockfd, portNumber;
      socklen_t clilen;
      char buffer[BUFFER_LENGTH];
      struct sockaddr_in serv_addr, from;
      int n;
  
      // Invalid arguments
      if (argc &lt; 2)
          exit(0);
      else if (atoi(argv[1]) &gt; 65535 || atoi(argv[1]) &lt; 1)
          exit(0);
  
      sockfd = socket(AF_INET, SOCK_STREAM, 0);
      if (sockfd &lt; 0) 
      {
          printf("Error opening socket.\n");
          exit(0);
      }
  
      // Taken from reference
      bzero((char *) &amp;serv_addr, sizeof(serv_addr));
      portNumber = atoi(argv[1]);
      serv_addr.sin_family = AF_INET;
      serv_addr.sin_addr.s_addr = INADDR_ANY;
      serv_addr.sin_port = htons(portNumber);
      if (bind(sockfd, (struct sockaddr *) &amp;serv_addr, sizeof(serv_addr)) &lt; 0) 
      {
          printf("ERROR on binding.\n");
          close(sockfd);
          exit(0);
      }
  
      // Get initial session key request
      int fromlen = sizeof(struct sockaddr_in);
      n = recvfrom(sockfd, buffer, BUFFER_LENGTH, 0, (struct sockaddr *)&amp;from, &amp;fromlen);
      if (n &lt; 0)
      {
          printf("Error in receiving.\n");
          exit(1);
      }
  </code></pre>
  
  <p>Thanks</p>