Can I create a Java UDP socket to listen for all addresses?

I want to have a datagram socket to listen to unicast and broadcast messages Is that possible?

Solution

By definition, broadcasting is a transmission function

If your UDP socket is listening on a specific port and binding to inaddr_ Any (also known as 0.0.0.0), it will receive all packets sent to the port, whether they are sent to a specific IP address of the local computer (i.e. unicast) or to a broadcast address of the local subnet

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>