Hi,
you should check UdpClient and UdpServer applications. You can find some hints on how to receive and process messages at application level (I'd suggest to implement your algorithm at application level first).
However, I'd strongly suggest to double checkk your algorithm, as it doesn't make sense. Mind, I'm not talking about the idea per-se (to rebroadcast a packet according to how many times you've seen it in a period). The flaw is in how the algorithm is described. If you try to implement it like it's written, you'll not succeed.
T.