title: LACP implementation, what's the right socket to use?
body: <p>I'm new using sockets.</p>
  
  <p>I must implement under linux environment, in user space, the LACP protocol. Each computer sends periodically for each ethernet interface a control message, a structure LACPDUs. 
  What would be the best family of sockets to get them to communicate(RAW, PACKET, TCP, UDP)? The socket send / receive must be of the same type?</p>
  
  <p>My application already sends well the LACPDUs, but the application on the other side does not receive them ( I was capturing with wireshark, it captures the packets, but dont reach the application).</p>
  
  <p>This is how i created the sockets: </p>
  
  <p><strong>Send paquet: (this works ok, even without binding)</strong></p>
  
  <pre><code>int sock, sent;
  struct sockaddr sa;
  if (sock = socket(AF_INET, SOCK_PACKET, htons(ETH_P_SLOW))&lt;0)   //sockfd = socket(int socket_family, int socket_type, int protocol);        
          {perror("error socketsalida\n");
          exit(EXIT_FAILURE);}
  sa.sa_family = AF_INET;
  strcpy(sa.sa_data, iface);
  if((sent = sendto(sock, data, len, 0, &amp;sa, sizeof(sa))) &lt;= 0)
                 {perror("error sendto\n");
          exit(EXIT_FAILURE);}
  close(sock);
  </code></pre>
  
  <p><strong>Receive packet: (this doesnt work)</strong> </p>
  
  <pre><code>int received, sockrec;
  struct sockaddr sa;
  struct LACPDU buffer;
  
  socklen_t addrlen = sizeof (sa);
  sockrec = socket(AF_INET, SOCK_PACKET, htons(ETH_P_SLOW));
  if (sockrec&lt;0) {perror("Error receiver socket\n");exit(EXIT_FAILURE);}
  if ((received = recvfrom(sockrec, &amp;buffer, BUFLEN, 0, (struct sockaddr *)&amp;sa, &amp;addrlen)) &lt; 0)
          {perror("Errorrecvfrom\n");exit(EXIT_FAILURE);}
  
  close (sockrec);
  </code></pre>
  
  <p>Any ideea? Thanks.</p>