开发者

How to find the IP address(DHCP) of a UPNP device on the network through c# code

I have a UPNP device plugged into the wall. It shows up in network places as a UPNP device, I can get the IP address by right clicking and and selectin开发者_JAVA百科g properties, but I need to know how to get the IP address dynamically in c# code or though a command window could also work.


You are looking for a flow called "UPnP Discovery".

Your C#-Code must broadcast UPnP Seach Requests, these are UDP multicast packets. Your UPnP devices will in turn send UPnP Search Responses, these are UDP unicast packets.

An UPnP Search Response contains an HTTP address to retrieve the XML description of the devices root device description. The host in the HTTP address typically is the devices network address.

Have a look at the UPnP spec.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜