Parallel http requests

前端 未结 2 1035
悲哀的现实
悲哀的现实 2021-01-07 09:52

I have an app that making API requests to the last.fm website using the backgroundWorker. Initially I don\'t know how many request I\'m gonna need to make. The response cont

2条回答
  •  死守一世寂寞
    2021-01-07 10:13

    You can do Async Web Request as well, using BeginGetResponse

          HttpWebRequest webRequest;
          webRequest.BeginGetResponse(new AsyncCallback(callbackfunc), null);
    
    
          void callbackfunc(IAsyncResult response)
          {
             webRequest.EndGetResponse(response);
          }
    

提交回复
热议问题