In my application, I have a DatagramSocket
. I want to set开发者_如何学C the socket so that it will receive DatagramPackets
from any IP-Address, and not have to specify one. Would this be possible at all?
I have a list of EndPoints
I want to send data to at some point, and expect the messages sent to me to come from these addresses, but I don't want to iterate through this list and individually receive packets.
Is there any way I can achieve this? I've done some extensive searches, but I can't seem to find a suitable answer...
That is the default behavior of sockets, you shouldn't have to worry about being limited to any particular IP address. Don't connect()
the socket, just call receive()
.
精彩评论