Example #1
0
 public void Send(Tracker tracker)
 {
     var enc = new MessageEncoder(PATH);
     enc.Add(_appId);
     enc.Add(tracker.uniqueId);
     enc.Add(Pack(tracker.transform));
     _server.Send(enc.Encode(), _clientEndpoint);
 }
Example #2
0
 IEnumerator Request()
 {
     while (true) {
         yield return new WaitForSeconds(interval);
         var oscEnc = new nobnak.OSC.MessageEncoder(OscNtpServer.NTP_REQUEST);
         var t0 = System.BitConverter.GetBytes(IPAddress.HostToNetworkOrder(HighResTime.UtcNow.ToBinary()));
         oscEnc.Add(t0);
         var bytedata = oscEnc.Encode();
         _client.Send(bytedata);
     }
 }
Example #3
0
 // Update is called once per frame
 void Update()
 {
     try {
         lock (_requests) {
             while (_requests.Count > 0) {
                 var req = _requests.Dequeue();
                 var oscEnc = new nobnak.OSC.MessageEncoder(NTP_RESPONSE);
                 oscEnc.Add(req.t0);
                 oscEnc.Add(req.t1);
                 var t2 = System.BitConverter.GetBytes(IPAddress.HostToNetworkOrder(HighResTime.UtcNow.ToBinary()));
                 oscEnc.Add(t2);
                 var bytedata = oscEnc.Encode();
                 _server.Send(bytedata, req.remote);
             }
         }
     } catch (System.Exception e) {
         Debug.Log(e);
     }
 }