Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Adding port forwards to Hololens

When the Hololens is tethered via USB, one can reach the Device Portal using http://127.0.0.1:10080 via the connected PC.

I assume the magic behind this is that TCP port 10080 (PC) is forwarded to TCP port 80 (HoloLens), all via the USB interface.

My question - is there a way to set up additional port forwards to the HoloLens? I would like to be able to communicate to a TCP port in my application running on the HoloLens, without being connected to WiFi.

Thanks,
Jason

Tagged:

Best Answers

  • Answer ✓

    I figured out how to do this, but it isn't easy...

    First, you can set up an additional forwarding port by following these instructions:
    http://sysdev.microsoft.com/en-us/Hardware/oem/docs/Phone_Testing/Configuring_IP_over_USB

    You'll have to add new registry keys as roughly described in the section called "IP over USB registry settings". The values you are looking for are in "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\IpOverUsbSdk". If you expand that category you'll see all of the existing forwarding paths. For example, the one labeled "Web" is responsible for forwarding 10080 on localhost to port 80 on the HoloLens. You'll have to manually duplicate an entry like "Web" but give it a new name and different ports. I don't know of a quick way to do this - I had to create a new key and then create each value inside of it "DestinationAddress, DestinationPort, etc" one at a time, being careful to get the types and labels right. You'll need to restart your computer or restart the IpOverUsb service after you make these edits.

    You can confirm that your new port forwarding path is working by running IpOverUsbEnum.exe from "C:\Program Files (x86)\Common Files\Microsoft Shared\Phone Tools\CoreCon\11.0\bin". If your forwarding path is listed there, you're good.

    I found the task of getting a raw TCP/IP socket server working on the HoloLens to be the hardest part. Between the out-of-date Mono implementation in Unity and everything that isn't available in UWP, there's not much left! This blog post was extremely helpful: http://through-the-interface.typepad.com/through_the_interface/2016/08/making-our-hololens-robot-dance.html, and the code he posted on github: https://github.com/KeanW/Dancing-Robot/tree/master/Assets/C#

    Good luck!

  • jbienzmsjbienzms mod
    edited January 2017 Answer ✓

    Hey guys. I asked about this internally and I have the official answer. Unfortunately it's probably not what you were hoping for. Here is the response I got back:

    Unfortunately, they found themselves using an unsupported feature. IPOverUSB is only intended for use by VS debugging, Device Portal, and the recovery tool. A security update in [14393.448] broke app access to IPOverUSB. IPOverUSB connections look like localhost and security changes to harden app isolation against loopback broke their ability to target IPOverUSB.

    Note that the person saying he can’t connect to the Device Portal over USB is hitting something completely different. I don’t know why that isn’t working for him. It should.

    So, it appears that it working before was an unintentional hole and they plugged that hole in 14393.448. Based on the response I can understand why they closed it (violating loopback isolation). Unfortunately it looks like you'll need to go to the wifi address to do what you're trying to do.

    Sorry, I know that's not what you were hoping for. I just wanted to follow up with the answer.

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

Answers

  • I'd also like to know the answer to this question. Is it possible to establish a TCP/IP connection over USB to an application running on the HoloLens?

  • Answer ✓

    I figured out how to do this, but it isn't easy...

    First, you can set up an additional forwarding port by following these instructions:
    http://sysdev.microsoft.com/en-us/Hardware/oem/docs/Phone_Testing/Configuring_IP_over_USB

    You'll have to add new registry keys as roughly described in the section called "IP over USB registry settings". The values you are looking for are in "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\IpOverUsbSdk". If you expand that category you'll see all of the existing forwarding paths. For example, the one labeled "Web" is responsible for forwarding 10080 on localhost to port 80 on the HoloLens. You'll have to manually duplicate an entry like "Web" but give it a new name and different ports. I don't know of a quick way to do this - I had to create a new key and then create each value inside of it "DestinationAddress, DestinationPort, etc" one at a time, being careful to get the types and labels right. You'll need to restart your computer or restart the IpOverUsb service after you make these edits.

    You can confirm that your new port forwarding path is working by running IpOverUsbEnum.exe from "C:\Program Files (x86)\Common Files\Microsoft Shared\Phone Tools\CoreCon\11.0\bin". If your forwarding path is listed there, you're good.

    I found the task of getting a raw TCP/IP socket server working on the HoloLens to be the hardest part. Between the out-of-date Mono implementation in Unity and everything that isn't available in UWP, there's not much left! This blog post was extremely helpful: http://through-the-interface.typepad.com/through_the_interface/2016/08/making-our-hololens-robot-dance.html, and the code he posted on github: https://github.com/KeanW/Dancing-Robot/tree/master/Assets/C#

    Good luck!

  • Thanks so much for posting this! I'll give it a try!

  • I've tried and have not seem to have gotten this to work.

    I wrote a sample program that listens on a TCP port using StreamSocketListener. It works over Wifi.

    But when I try to connect via localhost port forwarding, it does not work.
    Using Wireshark (with NcCap listening to localhost), I see valid TCP communication, but I does not enter the "OnConnection()" callback.

    Any ideas?

    No.     Time               Source                Destination           Protocol Length Packet Data Length Info
      78896 12:39:23.211218    127.0.0.1             127.0.0.1             TCP      108                       51125→9005 [SYN] Seq=0 Win=65535 Len=0 MSS=65495 WS=4 SACK_PERM=1
      78897 12:39:23.211258    127.0.0.1             127.0.0.1             TCP      108                       9005→51125 [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=65495 WS=256 SACK_PERM=1
      78898 12:39:23.211313    127.0.0.1             127.0.0.1             TCP      84                        51125→9005 [ACK] Seq=1 Ack=1 Win=212992 Len=0
      78899 12:39:23.211757    127.0.0.1             127.0.0.1             TCP      152                       51125→9005 [PSH, ACK] Seq=1 Ack=1 Win=212992 Len=34
      78900 12:39:23.211776    127.0.0.1             127.0.0.1             TCP      84                        9005→51125 [ACK] Seq=1 Ack=35 Win=525568 Len=0
      78901 12:39:23.211880    127.0.0.1             127.0.0.1             TCP      84                        51125→9005 [FIN, ACK] Seq=35 Ack=1 Win=212992 Len=0
      78902 12:39:23.211899    127.0.0.1             127.0.0.1             TCP      84                        9005→51125 [ACK] Seq=1 Ack=36 Win=525568 Len=0
      88104 12:39:44.237476    127.0.0.1             127.0.0.1             TCP      84                        9005→51125 [RST, ACK] Seq=1 Ack=36 Win=0 Len=0
    
  • edited November 2016

    I have a similar question, but in the opposite direction. I need to be able to access a webserver on the PC from the HoloLens via USB. This needs to happen in an environment where NO network connection is available for the HoloLens or the PC.

  • We got the Port Forwarding over USB to work for a while, but then it broke when we got a HoloLens OS update.

    Working:
    o OS Build: 10.0.14342.1016
    o Firmware revision number: 0005.05.M.1604281147R

    Stopped working:
    o OS Build: 10.0.14393.448
    o Firmware revision number: 0005.05.P.1606291233R

    Has anyone else experienced the same (and have a solution)?

  • utekaiutekai ✭✭✭

    Still hoping this gets a solution, I'm currently unable to connect to HoloLens using Windows Device Portal, except on wireless network.

    Connecting with only USB cable would be nice ... or with Bluetooth. The code download works with bluetooth when developing.

  • Hi,

    so assuming that it is possible to establish a connection over usb in OS BUild <= 10.0.14342.1016 it should be possible to downgrade/reset the hololens with the Windows DeviceRecovery Tool. So maybe with a downgrade we can use the IpOverUSB with our own ports again. Anyone has already tried it? I dont have a hololens here right now and befor trying i need to talk with my boss about this.

  • jbienzmsjbienzms mod
    edited January 2017 Answer ✓

    Hey guys. I asked about this internally and I have the official answer. Unfortunately it's probably not what you were hoping for. Here is the response I got back:

    Unfortunately, they found themselves using an unsupported feature. IPOverUSB is only intended for use by VS debugging, Device Portal, and the recovery tool. A security update in [14393.448] broke app access to IPOverUSB. IPOverUSB connections look like localhost and security changes to harden app isolation against loopback broke their ability to target IPOverUSB.

    Note that the person saying he can’t connect to the Device Portal over USB is hitting something completely different. I don’t know why that isn’t working for him. It should.

    So, it appears that it working before was an unintentional hole and they plugged that hole in 14393.448. Based on the response I can understand why they closed it (violating loopback isolation). Unfortunately it looks like you'll need to go to the wifi address to do what you're trying to do.

    Sorry, I know that's not what you were hoping for. I just wanted to follow up with the answer.

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

  • bkfichterbkfichter
    edited November 2018

    It is very irritating how MS locks down the Hololens. I NEED to use the usb as a tethered port. I don't understand why they cannot unlock this. Maybe there is a valid technical reason. But my experience has been that MS makes a lot of assumptions about what devs and users will want to do and force them into whatever it is...aka Win 8 UI design rules. I'm assuming they just don't want it to be a tethered device. Makes me have to evaluate other devices. #venting

  • @WithinReason
    Hi,
    I can't open this link.
    http://sysdev.microsoft.com/en-us/Hardware/oem/docs/Phone_Testing/Configuring_IP_over_USB
    Can you please tell me how to build the connection between Hololens and a network over ethernet '?

Sign In or Register to comment.