예제 #1
0
    // receive thread
    private void ReceiveData()
    {
        string realIp = ip;

        log("Connecting to: " + realIp, true);

        int ipTest = int.Parse(realIp.Split('.')[0]);

        if (ipTest < 224)
        {
            Debug.Log("Using Unicast");
            udp = UdpReceiver.NewUnicast(realIp, port, 0);
        }
        else
        {
            Debug.Log("Using Multicast");
            udp = UdpReceiver.NewMulticast(realIp, port, 0);
        }

        log("Connected to: " + realIp, true);
        //Infinite Loop processing data
        while (true)
        {
            try
            {
                Loop();
            }
            catch (Exception err)
            {
                print(err.ToString());
                log("Connection Error");
            }
        }
    }