Пример #1
0
        public Task <long> GetCurrentPingViaHeadRequest(string ipOrUrl = "8.8.8.8", int timeoutInMs = 1000)
        {
            Stopwatch t = Stopwatch.StartNew();

            return(WebRequestRunner.GetInstance(this).StartCoroutineAsTask(SendHeadReqTo(ipOrUrl), () => {
                t.Stop();
                return t.ElapsedMilliseconds;
            }).WithTimeout(timeoutInMs));
        }
Пример #2
0
        public Task <T> GetResult <T>()
        {
            var resp = new Response <T>();

            return(WebRequestRunner.GetInstance(this).StartCoroutineAsTask(prepareRequest(resp), () => resp.getResult()));
        }
Пример #3
0
 private async Task <T> SendRequest <T>(Response <T> resp)
 {
     resp.WithProgress(onProgress);
     return(await WebRequestRunner.GetInstance(this).StartCoroutineAsTask(PrepareRequest(resp), () => resp.getResult()));
 }