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.

UdpClient could not be found?

I'm trying to work some existing unity scripts into the hololens but basic network objects are not working on the hololens (get UdpClient could not be found when I try to build out C# projects). Does the hololens restrict all your network code or is there just some setup that's needed? To be safe I tried to select all capabilities that sound network related but it's not helping.

Tagged:

Best Answer

  • PatrickPatrick mod
    Answer ✓

    This isn't HoloLens per se, but UWP. For UWP the networking related stuff that used to be in System.Net is in Windows.Networking.

    This is not my area of expertise, but it appears that UdpClient has also been renamed to DatagramSocket.

    And with those two things in mind, you'll likely need to maintain two classes, or one class with a lot of #ifdefs. One class to make the Unity Editor (which isn't UWP) happy, and the other class to make the HoloLens build happy. The spatial mapping code in the HoloToolkit has two classes, remotemeshsource.cs (UWP) and remotemeshtarget.cs (not UWP) that do this using TCP.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

Answers

  • PatrickPatrick mod
    Answer ✓

    This isn't HoloLens per se, but UWP. For UWP the networking related stuff that used to be in System.Net is in Windows.Networking.

    This is not my area of expertise, but it appears that UdpClient has also been renamed to DatagramSocket.

    And with those two things in mind, you'll likely need to maintain two classes, or one class with a lot of #ifdefs. One class to make the Unity Editor (which isn't UWP) happy, and the other class to make the HoloLens build happy. The spatial mapping code in the HoloToolkit has two classes, remotemeshsource.cs (UWP) and remotemeshtarget.cs (not UWP) that do this using TCP.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • Much appreciated Patrick, I'll start up my ifdefs then :)

  • If you didn't already know you can open two versions of your solution. One that is setup with UNITY_EDITOR defined, and one that is not. If you double click a script in the Unity editor, the solution with UNITY_EDITOR will launch. When you build from Unity, the solution in the folder you build to is the solution without UNITY_EDITOR defined. When creating the spatial mapping scripts this was very helpful to me.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • Hi Elspin,
    I ran into this problem as well. Here is an example of some working UDP code:
    http://forums.hololens.com/discussion/578/hololens-udp-server

  • ElspinElspin
    edited May 2016

    @vigiljt said:
    Hi Elspin,
    I ran into this problem as well. Here is an example of some working UDP code:
    http://forums.hololens.com/discussion/578/hololens-udp-server

    Thanks vigiljt, I am having a huge amount of issues with networking for the hololens in general. There's a huge mess of supported/unsupported functions in classes lacking documentation of any kind on msdn so maybe this will help. I had code pretty close to that and all I really got was a mess of random data, not sure what was different but I'll give it a try.

    In general there needs to be a huge overhaul I'd say of MSDN, code that works on one platform will not work on another platform with no mention, and there doesn't appear to be any proper documentation of what functions are available ie System.Net.Sockets.Socket being present on UWP but lacking basically all of the functions you'd probably want to use and generally not functioning the way it does on windows. Very concerning

Sign In or Register to comment.