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.

Sending network data to/from HoloLens, help needed

Hi All,

What I want to do is send some networking data to a Unity script running on the HoloLens but my usual tricks don't seem to work due to UWP.

My favorite C++ networking library ZeroMQ does not offer UWP support, actually seems like all other C++ libraries I know ignore UWP btw.
Writing a C++ plugin dll for Unity that uses ZeroMQ is not too hard, but seems to fail to load when used in a Unity UWP build.
Possibly due to it needing kernel32.dll and UWP conflicts, but the debugger/messages don't really give a clue as to why it doesn't load.
Seems no one I asked knew anything about this unfortunately, so this is a dead end for now. :(

Ok so instead of going with C++ (and sticking to only simple and small data packets for now then) I tried the C# route.
I wrote a script using TcpClient (or UdpClient for that matter) that works in the editor.
However when building as a UWP app for HoloLens it seems System.Net.Sockets is not supported and once again things fail.

Anyone has some tips on how to communicate to/from the HoloLens from another machine using TCP/UDP?
Some simple example scripts would be very welcome!!
I'm sure I can't be the only one trying to do this right!?


Best Answer


  • Hi Brekel, I am trying to send OSC messages from the Kinect to the HoloLens and posted a somewhat related question.

    I'm working with the CustomMessages script in the HololensToolkit right now, but if you figure out a good workaround please post!

  • BrekelBrekel ✭✭

    Thanks, just spotted your related question now indeed.
    I'm looking at that now as well at least to get some simple stuff streaming.

    Seems UWP adds a lot of headaches when trying to work with 3rd party libs unfortunately.

  • Possible work around...This only works on my private network (to avoid dealing with questions of authentication etc. for now which might make it impracticle for a shipping product)...but I was able to add SignalR client with UWP to provide socket-like functionality to a SignalR server website on my network. (I think the documentation I read said that it didn't use Websockets from .net clients, more long polling.)

    Looking into WebRTC clients to see how much can put P2P communications on their own channel and just need a STUN or other server to help initiate P2P com..

  • Oh separate thing to point out, some low-level functionality can be disabled/unavailable without the Pro Unity license...so that could be something disrupting your attempts at low-level sockets. I know specifically some network comm was involved at least for the non-UWP platforms like Android, with the work around to use the WWW and WWWForm classes with unity rather than the Webclient (but that only covers HTTP). (Also for UWP you have to check that you granted the right appx manifest permissions, they had different ones for private networking, client, client/server.

  • BrekelBrekel ✭✭

    Thanks for all the tips guys!

    I believe I did set all the capabilities when testing, but I believe that didn't help for the C++ plugin and TcpClient.

    Looks like SignalR is not really something I'm looking for.

    I have started digging through the 240 tutorial code and HoloToolkit scripts.

    I only need raw (yet very efficient) TCP/UDP packets on a local network to stream data from several tracking devices into HoloLens so opening a port is no problem.

  • BrekelBrekel ✭✭

    Btw @ahillier looking at RemoteMeshTarget.cs, it uses TcpListener and TcpClient, but is wrapping it in #if UNITY_EDITOR blocks as it appears those classes are not available on HoloLens/UWP.

    My problem is not so much doing networking in general as I have working code in C++ and Unity/C# for the desktop.
    It's simply figuring out what is supported on HL/UWP and what isn't.

  • Hello @Brekel ,

    Did you succeed on streaming data from your server into HoloLens?

    I am trying to implement communication between HoloLens and a server using websockets but, apparently, the most used websockets libraries are not supported on HoloLens and and I can't establish a proper connection using Windows.Networking.Sockets

  • BrekelBrekel ✭✭

    Yes I succeeded (see forums.hololens.com/discussion/1201/hololens-with-autodesk-motionbuilder).
    I ended up building a custom networking class in C++ using winsocks instead of relying on my favourite existing library (ZeroMQ) since it isn't supported under UWP.

Sign In or Register to comment.