none
How to get an emulator network adapter with an IP from DHCP?

    Question

  • First, let's take a look at Visual Studio Emulator for Android that works perfectly as following (please note the two Emulator Adapters one of which has an IP from DHCP: 192.168.1.188):

    Now, let's see Visual Studio emulator for Windows Phone:

    Please note it has only one Emulator Adapter with a link-local address (169.254.144.97). 

    Could anyone offer a tip on how to make the WP emulator also have a second Emulator Adapter with a DHCP IP?

    The WP emulator used to have two Emulator Adapters and work perfectly, but it lost one somehow.  I have a network related problem with the WP emulator now, and I believe it is caused by missing the second emulator adapter.


    Hong

    Monday, February 13, 2017 11:02 PM

All replies

  • Hi Hong,

    There are somethings strange happened in my side, at first I could repo your issue:

    But serval useless click on buttons, I have get the following screenshot:

    It is ok, but I do not know why? So I can only tell you what I operated in my side.

    1). In additional Tools, I clicked Enable network simulation and choose Network speed, clicked Checkpoins, clicked OptionalSettings, clicked Notifcations, clicked NFC, clicked Accceletrometer, clicked Location, clicked Screenshot, clicked SD Card buttons.

    2). And I have click the settings in emulator for WP, and open some app. Checked the wi-fi.

    3). Then when I reopen the Additional Tools, and click the Network, it is strange that Emulator Adapter #2 displayed. I do not know why, so I tell you that above are my operations. And I have launched the other emulator, and with the same ways then Adapter #2 displayed.

    So please refer to my above steps. Hope it helpful for you.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 14, 2017 7:26 AM
    Moderator
  • Thanks a lot for looking into it, Oscarw.

    The second emulator adapter does not have DHCP IP.  It is still a link-local IP address.  I think the problem that I am having is caused by that no emulator adapter has a DHCP IP.  It used to have one.   


    Hong

    Wednesday, February 15, 2017 12:31 AM
  • Hi Hong,

    In my side, I could not open the wi-fi switch of WP emulator. In Android emulator I could open wi-fi and change the IP setting as DHCP or static.

    So whether a physical device could add the DHCP IP in your side?

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, February 15, 2017 2:10 AM
    Moderator
  • Hello Oscarw,

    Physical devices including Windows PCs and Windows Phones have no problem in obtaining DHCP IPs. They work normally. I think this is related to how Hyper-V is set up.  I played with Hyper-V Manager a bit, have not made and difference.


    Hong

    Thursday, February 16, 2017 11:15 AM
  • Hi Hong,

    Whether you could change the virtual switch in Hyper-v manager:

    And during your developing, whether your emulator could not access the internet or not?

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 17, 2017 7:30 AM
    Moderator
  • Hello Oscarw.

    I have been playing Virtual Switches for the past few days, and it has made no difference. 

    I decided to start clean for the emulators by doing the following:

    1. Remove all virtual machines from Hyper-V Manager.
    2. Remove the Hyper-V feature from the OS.
    3. Reset the network of the computer.
    4. Restart the computer.
    5. Add Hyper-V back to the OS.
    6. Restart the computer again.
    7. Start a WP emulator from VS2015.

    The problem remains.  I added a virtual switch with connection type of external network, then add the switch to a WP emulator, but that switch was removed immediately after the emulator was started from VS2015. 


    Hong

    Sunday, February 19, 2017 2:16 AM
  • Hi Hong,

    My colleague has encountered the same issue as yours. So please update your OS to see whether has the same issue.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 21, 2017 9:17 AM
    Moderator
  • Hello Oscarw,

    Here is the OS information of the PC:

    Let me tell you one of the reasons that I have been asking this.   A Windows Phone app offers a web service, and it needs to tell user which IP should be used to access the service. Currently it is unable to find the correct IP address.  None of the ones from  NetworkInformation.GetHostNames() works.  It used to work when there was an emulator switch with a DHCP IP that is 192.168.x.x.


    Hong

    Tuesday, February 21, 2017 10:02 AM
  • Hi Hong,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks for your understanding!

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 23, 2017 6:55 AM
    Moderator
  • Thanks a lot for your persistent help, Oscarw.

    Let me show you one specific problem related to this just in case it is helpful.

    An app responds to discovery broadcast requests to tell which IP should be used to access its service. This works perfectly on a physical phone, but not on the emulator.  The following screenshot shows the problem:

    Microsoft's superior emulators are preferred for debugging because they are much faster than peers and physical devices.


    Hong

    Friday, February 24, 2017 1:42 AM