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.

Help with UDP problem

edited August 2017 in Questions And Answers

I'm just trying to get some sort of code to work that can read in information from a UDP source to Hololens, and I can't seem to be getting through. I'm using this code and Packet Sender to test, but I don't see any results. Is my changing the boolean value in the event and letting the Update loop change my textmesh not allowed? I'm drawing a bit of a blank here.

Note, this represents all the code as it is.

`using UnityEngine;
using System;
using System.IO;


using Windows.Networking.Sockets;


public class UDPListen : MonoBehaviour
public TextMesh test;
public string port;
//public string word;
public bool rec;


DatagramSocket socket;
// use this for initialization
async void Start()

    Debug.Log("Waiting for a connection...");

    socket = new DatagramSocket();
    socket.MessageReceived += Socket_MessageReceived;

        await socket.BindEndpointAsync(null , port);
    catch (Exception e)

    Debug.Log("exit start");



// Update is called once per frame
void Update()
    if (rec)
        test.text = "worked";


private async void Socket_MessageReceived(Windows.Networking.Sockets.DatagramSocket sender,
    Windows.Networking.Sockets.DatagramSocketMessageReceivedEventArgs args)
    //Read the message that was received from the UDP echo client.
    Stream streamIn = args.GetDataStream().AsStreamForRead();
    StreamReader reader = new StreamReader(streamIn);
    string message = await reader.ReadLineAsync();
    rec = true;
    //word = message;
    Debug.Log("MESSAGE: " + message);



Sign In or Register to comment.