I don't know. I try to rewrite this metronuggest code to c++ and I get this:
If you're not going to actually follow the questions and instructions that people offer in this thread, you are very unlikely to get good help from the thread.
You said:
DatagramSample runs very well
I asked:
Does the datagram sample run well with broadcast?
You said:
I don't know.
I suggest that you actually change the datagram sample to use broadcast, without porting anything to another language.
If you can make that run well with broadcast, then you can prove that your network and hardware is not the problem.
If you cannot make that run with broadcast, then it's possible that your network is the problem.