title: Possible causes of errno 97 aka EAFNOSUPPORT aka Address family not supported by protocol
body: <p>I am currently modifying Dennis Bush's UFTP (<a href="http://uftp-multicast.sourceforge.net" rel="nofollow">http://uftp-multicast.sourceforge.net</a>) to fit my needs. What I am currently trying to do is change the address to which the clients send the COMPLETE message. I would like the clients of my modified version of UFTP to multicast the COMPLETE messages instead of unicasting it back to the server, because I need every client in the multicast group to be able to see the COMPLETE messages that are sent, and not just the server.</p>
  
  <p>The author of UFTP has told me that I should modify <strong>client_transfer.c, line 359, nb_sendto() function call, 5th argument</strong> to a structure containing the private multicast address and port to which I wish to send the COMPLETES. Unfortunately, I am getting the "Address family not supported by protocol" error. The code section was originally like this:</p>
  
  <pre><code> if (nb_sendto(listener, outpacket, payloadlen, 0,
                 (struct sockaddr *)&amp;group_list[listidx].replyaddr,
                 sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
          sockerror(group_list[listidx].group_id, group_list[listidx].file_id,
                  "Error sending COMPLETE");
      } else {
          log(group_list[listidx].group_id, group_list[listidx].file_id,
                  "COMPLETE sent");
      }
      set_timeout(listidx);
  
      free(buf);
      free(encrypted);
  </code></pre>
  
  <p>My current code looks like this:</p>
  
  <pre><code>if (nb_sendto(listener, outpacket, payloadlen, 0,
        ////modified line:
                (struct in_addr *)&amp;group_list[listidx].multi.s_addr, //struct in_addr multi;
        ////end of modified line
                 sizeof(struct sockaddr_in)) == SOCKET_ERROR) {
          sockerror(group_list[listidx].group_id, group_list[listidx].file_id,
                  "Error sending COMPLETE");
      } else {
          log(group_list[listidx].group_id, group_list[listidx].file_id,
                  "COMPLETE sent");
      }
      set_timeout(listidx);
  
      free(buf);
      free(encrypted);
  </code></pre>
  
  <p>The error is, to me, pretty vague. What exactly does it mean? What could be the possible causes of such an error? Could someone point me in the right direction?</p>