title: recvfrom: Bad address, sendto: Address family not supported by protocol
body: <p>i'm trying to implement a little UDP-Server/Client Application in C and got two errors on Server-side:  <strong>recvfrom: Bad address</strong> &amp;&amp; <strong>sendto: Address family not supported by protocol</strong>. I searched for the mistake and googled for answers but, unfortunately, they wasn't really helpfully... maybe i'm casting a parameter in a wrong way and don't get it. I hope you can give me a hint :).</p>
  
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;ctype.h&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;arpa/inet.h&gt;
  #include &lt;errno.h&gt;
  
  #define BUFFSIZE 256
  #define IP "127.0.0.1"
  #define PORT 7755
  
  int main(void){
  
    int socket_fd = socket(AF_INET, SOCK_DGRAM, 0);
    char buffer[1] = "s";
  
    struct sockaddr_in src_addr;
    struct sockaddr_in dest_addr;
  
    src_addr.sin_family = AF_INET;
    src_addr.sin_port = htons(PORT);
    src_addr.sin_addr.s_addr = inet_addr(IP);
  
    if(socket_fd==-1)
      perror("socket");
  
    if(bind(socket_fd, (struct sockaddr*)&amp;src_addr, sizeof(src_addr))==-1)
      perror("bind");
  
    if(recvfrom(socket_fd, buffer, 2, 0, (struct sockaddr*)&amp;dest_addr, (unsigned int *)sizeof(struct sockaddr_in))==-1)
      perror("recvfrom");
  
    if(sendto(socket_fd, buffer, 2, 0,(struct sockaddr*)&amp;dest_addr, sizeof(dest_addr))==-1)
      perror("sendto");
  
    if(close(socket_fd)==-1)
      perror("close");
  
    return 0;
  
  }
  </code></pre>