So I created a socket with socket(AF_INET, SOCK_RAW, IPPROTO_UDP). And then I have it recv() with a infinite loop. I know it can captures all datagrams. But will it stop datagrams going to the right places? I made a little experiment. I send very simple UDP message from one program to another. And they both received the message. I assume the raw socket won't block any UDP messages. I then read about it in the second paragraph of this question's best answer. It says an unbound udp socket will mess up the system. So I am not sure that is the same with raw socket. Or is it different on linux and windows?
And another quick question: binding socket(AF_INET, SOCK_RAW, IPPROTO_UDP) with a port won't do anything, right? I did it and the socket still receive messages going to all kinds of other ports.