locked
How to get IP address of PnpObject.

All replies

  • Hi Take,

    I showed how to retrieve an IP address in C# here: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/2ca0d5de-9db5-4349-839c-e01ff614ec6e

    So you could do something similar in your case (write a C# winmd component).

    If it is an available property on the PnP device I think you could query it, however this is not a straight property-value 1:1 assignment.  An adapter can have several IP addresses bound to it.

    Why you need this information for a Metro Style application.  Could you expand on your use-case and why you need to do this?

    -Jeff


    Jeff Sanders (MSFT)
    Tuesday, November 29, 2011 4:05 PM
    Moderator
  • Hi jpsanders,

     

    Thank you for replay.

    I want to develop a HTTP client application as Metro style app.

    However ip address of HTTP server is not known. I need to know ip address of this HTTP server using SSDP. 

     

    In my understanding, when I search UPnP device, I should use Windows.Devices.Enumeration.Pnp.PnpObject.findAllAsync(), right?

     

    Thanks.

     

    Wednesday, November 30, 2011 5:41 AM
  • Hi Take,

    Where is your HTTP Server located?  If it is on the same machine, and not in your appx package, this will not work because local IPC communciaton is blocked for Metro Style applications.  If it is not on the same machine why would enumerating your PnP devices help?

    Yes you can enumerate the PnP devices.  See this: http://msdn.microsoft.com/en-us/library/windows/apps/hh464997(v=vs.85).aspx

    -Jefj


    Jeff Sanders (MSFT)
    Wednesday, November 30, 2011 12:47 PM
    Moderator
  • Hi jpsanders,

    My HTTP server is located at home network(not same machine) and it gets IP address by DHCP.

    (ex. IP address of Win8 machine is 192.168.0.2, IP address of HTTP server is 192.168.0.5) 

     

    IP address of this HTTP server is not static, assigned by DHCP.

    This HTTP server is also DLNA device, so I need to get IP address of HTTP server using SSDP. 

    Can I get IP address of this HTTP server from Pnpobject?

     

    Thanks.

    Monday, December 12, 2011 6:04 AM
  • I see,

    Since this is an HTTP server did you try the code I suggested?  Are you able to hit your HTTP Server with Internet Explorer from the Win8 machine?

    -Jeff


    Jeff Sanders (MSFT)
    Monday, December 12, 2011 12:57 PM
    Moderator
  • If your UPnP device supports PNP-X then you can discover and pair your device using metro device settings UI. Once the device is paired, you can enumerate your device and retrieve the device properties such as ServiceControlUrl, ServiceDescriptionUrl, ServiceEventSubscriptionUrl and IP address. Check the sample code I posted at http://social.msdn.microsoft.com/Forums/en-US/tailoringappsfordevices/thread/d40b02e1-27cd-4103-879f-913c7658edf1.

    Tuesday, March 06, 2012 8:01 PM