HttpClient behaviour Win10 vs Linux

  .net-5, c++, http, linux, windows

I am currently trying to create a software that interact with device over HTTP(Antminer). When I am running the code on Win10 it is working without any problem but when I run it on Linux(Debian 11) the device stop responding to the request after about 30 sec. Even if I try to access the device from an other computer on a browser it doesn’t work.

I used .Net 5. Here is the code that send the request to the device. Thanks for the help!

        private async Task<HttpResponseMessage> SendRequest(string url, string method, HttpContent content = null)
        {
            var uri = new Uri(url);

            if (_client == null)
            {
                var credCache = new CredentialCache();
                credCache.Add(new Uri($"http://{uri.Host}/"), "Digest", new NetworkCredential(_user, _pass));

                _client = new HttpClient(new HttpClientHandler { Credentials = credCache });
                _client.Timeout = TimeSpan.FromSeconds(5);
            }

            using (var request = new HttpRequestMessage(new HttpMethod(method), uri))
            {
                if (content != null)
                    request.Content = content;

                return await _client.SendAsync(request);
            }

        }

Source: Windows Questions

LEAVE A COMMENT