How to ignore your own broadcast udp packets

后端 未结 5 809
甜味超标
甜味超标 2020-12-11 02:29

For the following I\'m assuming one network card.

I have a component of my program which is designed to let others in the subnet know of its existence. For this, I\

5条回答
  •  感情败类
    2020-12-11 02:43

    getsockname (function documentation) can discover the local IP address associated with a particular socket. If you call this on the socket you're using to send the broadcast, you should see the same IP address you'll see returned by recvfrom.

提交回复
热议问题