Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. 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

Answers

  • 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.

  • 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.

  • stepan_stulovstepan_stulov ✭✭✭
    edited July 2018

    DELETED

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

  • @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.

  • @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?

  • 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:

    https://foxypanda.me/tcp-client-in-a-uwp-unity-app-on-hololens/

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

Sign In or Register to comment.