开发者

Is it possible to set a DatagramSocket to receive from any other IP-Address?

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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜