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.

TCP Sockets - Sending Image data from Python client to Hololens Server

Hi there, after weeks of frustration I was finally able to get a simple message sent from my python client to my hololens server. My ultimate goal is to get an image sent instead of just a simple string message. Is anybody experienced with doing something like this? I would really appreciate any guidance on this, I'm very new to sockets and the hololens seems to only make it more difficult.

Current code I have: https://gist.github.com/jryebread/3961e890375fcc8a64c8ac3d279ec9fa

I think the python code is sending the image correctly its just that on the receiving end I don't think I am dealing with the bytes array properly.

Best Answer


  • Options

    Hey thanks so much for your explanation! Very helpful. So I'd be sending an integer value over the buffer first and then writing a while loop to iterate over the integer size? I'd love to see some example code for this.

  • Options
    mtaultymtaulty ✭✭
    edited July 2018

    I made a simple 2D app which you can run on your desktop which sends an image over a socket to itself and I dropped it on GitHub.

    I hope that helps - you'd need to remove the 2D parts of this which are about displaying an image in XAML.

    You click a button to choose an image, then another button to send/receive over the socket.

  • Options
    stepan_stulovstepan_stulov ✭✭✭
    edited July 2018


    Building the future of holographic navigation. We're hiring.

  • Options

    @mtaulty So it turns out I can't use your code for the hololens because it uses System.Net.Sockets which only works in Unity and does not work with the Hololens. For the Hololens you can only use the Windows.Networking.Sockets stuff. Gonna have to translate your github code to use that, because for example the hololens build code doesn't recognize TCPListener.

  • Options

    @jamesryebread Hi - I'm not sure what you mean here. I just ran that 2D app on the HoloLens emulator (17134) and it ran fine and a picture transferred from one side to the other. Can you not run the 2D app on HoloLens?

  • Options
    edited August 2018

    I was able to get it working by sending the image as a base 64 encoded string from python to the hololens. Thanks for your help and code examples! :)

    I'm not sure how the emulator works but whenever I try to run code that uses System.Net.Sockets the Hololens/UWP complains that the library is not found. This guy talks about it in his blog post:


    my code: https://gist.github.com/jryebread/2bdf148313f40781f1f36d38ada85d47

Sign In or Register to comment.