Quantcast
Channel: Recent Discussions — Mixed Reality Developer Forum
Viewing all articles
Browse latest Browse all 10543

Hololens UDP server?

$
0
0

Hello,

I'm trying to build a simple UDP server to run on the Hololens. However, I'm getting the error:
The type or namespace name 'UdpClient' could not be found (are you missing a using directive or an assembly reference?)

Here's the code:

using UnityEngine;
using System.Net;
using System.Net.Sockets;

public class AndroidUDPListener : MonoBehaviour {

    // Use this for initialization
    void Start () {
        Debug.Log("Waiting for a connection...", gameObject);

        UdpClient udpServer = new UdpClient(12345);

        var remoteEP = new IPEndPoint(IPAddress.Any, 11000);
        var data = udpServer.Receive(ref remoteEP); // listen on port 11000
        Debug.Log("receive data from: " + remoteEP.ToString(), gameObject);
        Debug.Log("data: " + data, gameObject);
    }

    // Update is called once per frame
    void Update () {

    }
}

I'm following the code from this example:
http://stackoverflow.com/questions/20038943/simple-udp-example-to-send-and-receive-data-from-same-socket

Additionally, Visual Studio seems to think the "using System.Net.Sockets;" directive isn't necessary. Can anyone please help? Thank you


Viewing all articles
Browse latest Browse all 10543

Trending Articles