Exemple #1
0
        public void Run()
        {
            while (true)
            {
                //poll waits 100000 microseconds (1/10 seconds)
                if (transport.Poll(100000))
                {
                    data = new byte[4096];
                    int lenght;
                    try
                    {
                        lenght = transport.ReceiveFrom(data, ref currentEndPoint);
                    }
                    catch
                    {
                        continue;
                    }

                    byte[] dataTruncated = new byte[lenght];
                    Array.Copy(data, 0, dataTruncated, 0, lenght);

                    ExtractPacket(dataTruncated, lenght);
                }

                DeltaTime = watch.ElapsedMilliseconds / 1000f;
                watch.Restart();

                Update();
            }
        }
Exemple #2
0
        public void Run()
        {
            while (true)
            {
                if (transport.Poll(100000))
                {
                    data = new byte[4096];
                    int lenght = transport.ReceiveFrom(data, ref currentEndPoint);

                    ExtractPacket(lenght);
                }

                Update();
            }
        }