If the slave doesn't have a collision there is nothing for the master to read. The master would then be blocked forever, unless you have a timeout on the master read.
As a test make the if check for collision in the slave always true and see if your program works. This way the slave is always sending data to the master and when it posts a read there will be something there for it to read.
@histrungalot, thanks for the answer.
The problem was in winsock. For recvfrom(), the default mode is blocking mode. I've changed it to non-blocking mode and it worked; however, I've got another problem which is recvfrom() and sendto() slow down the process a little bit. I don't why? I've tried send() and recv() but with no luck.