简体   繁体   English

如何跟踪HttpClient发布的进度

[英]How to track the progress of HttpClient post

I'm building an Android app that sends binary data to the server using HttpClient PostAsJsonAsync method. 我正在构建一个使用HttpClient PostAsJsonAsync方法将二进制数据发送到服务器的Android应用。 Is is possible to track the progress of the data being sent? 是否可以跟踪发送数据的进度?

I'm using the code below to send the data to the server: 我正在使用下面的代码将数据发送到服务器:

                    var client = new HttpClient();

                client.BaseAddress = uri;

                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(
                        new MediaTypeWithQualityHeaderValue("application/bson"));

                var result = client.PostAsJsonAsync(uri, fileBytes);

Implement your http post using an AsyncTask. 使用AsyncTask实现您的http帖子。 By using this task you can track the progress of the task. 通过使用此任务,您可以跟踪任务的进度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM