libtins
libtins copied to clipboard
Send packet error in OS X
I write a little demo in my MacBook.
#include <tins/tins.h>
#include <cstdio>
#include <unistd.h>
using namespace Tins;
int main() {
NetworkInterface iface("lo0");
EthernetII eth = EthernetII("00:00:00:00:00:03", "00:00:00:00:00:01");
IP ip = IP("192.168.0.1", "192.168.0.2");
eth /= ip;
PacketSender sender;
printf("start \n");
for(int j=0; j<10; j++)
sender.send(eth, iface);
printf("end \n");
}
I use tshark sniff packets has been sent. The result is:
I use brew install and source code install. There is nothing different. The same code I run in linux, result is right.