开发者

How could I get a broadcast address on given port?

开发者 https://www.devze.com 2023-03-17 12:02 出处:网络
How can I get a broadcast address for a g开发者_开发百科iven port in C#? Is using something in NetworkInterface.GetAllNetworkInterfaces()

How can I get a broadcast address for a g开发者_开发百科iven port in C#?

Is using something in NetworkInterface.GetAllNetworkInterfaces() the right way?

Thank you

Clarification: I'd like to get an array of all broadcast addresses. Then I'd add a given port and return IPEndPoint[].


I did it by getting IP address, subnet mask and then doing IP OR ~SUBNET on each byte.

broadcast[i] = (byte)(ip[i] | ~sub[i]);

0

精彩评论

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