title: Raw Sockets Vs Libpcap in sending performance
body: <p>I'm currently attempting to get the best sending performance for an 802.11 frame, I am using libpcap but I wondered if I could speed it up using raw sockets (or any other possible method).</p>
  
  <p>Consider this simple example code for libpcap with a device handle already created previously:</p>
  
  <pre><code>char ourPacket[60][50] = { {0x01, 0x02, ... , 0x50}, ... , {0x01, 0x02, ... , 0x50} };
  
  for( ; ; )
      {
          for(int i; i = 0; i &lt; 60; ++i)
          {
              pcap_sendpacket(deviceHandle, ourPacket[i], 50);
          }
      }
  </code></pre>
  
  <p>This code segment is done on a thread for each separate CPU core. Is there any faster way to do this for raw 802.11 frame/packets containing Radiotap headers that are stored in an array? </p>
  
  <p>Looking at pcap's source code for <code>pcap_inject</code> (the same function but different return value), it doesn't seem to be using raw sockets to send packets? No clue.</p>
  
  <p>I don't care about capturing performance, as a lot of the other questions have answered that. Is raw sockets even for sending layer 2 packets/frames?</p>