I am working on a project that has 2 computers connected via Gig Ethernet both running linux. The idea is that one computer (Host A) will receive a bunch of data process it and send it back to the other machine (Host B)..
I am using a raw socket and broadcasting the data between the 2 machines. I want to use broadcast because I need to be able to replace Host A or B without changing any configuration (ie configuring the src an dest MAC Addresses), plus this is a point-to-point network without any other machines on it.
The problem is that when I send data this way, my recieve raw socket (on the same machine) also gets the data that I am sending out.
Why is this?
I know that I can filter the data out with recieve code but I would rather not have this happen in the first place. I don't want this data clogging up the system while I am trying to recieve the real data from the other host.
This is how my socket is created.
s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
I am binding it to an interface (ie eth0), and using sendto and recvfrom.