c# - Web Request asynchronous iscompleted -


i use this. http://www.matlus.com/httpwebrequest-asynchronous-programming/

but how can know request iscompleted? how know work done?

i use :

postasync(url, postparameters, callbackstate => {     if (callbackstate.exception != null)     {         throw callbackstate.exception;     }     else     {         writecallback(getresponsetext(callbackstate.responsestream));     } }); 

but not know whether ends process?

in documentation says:

each of these methods requires callback delegate called response of http call[...] callback called each response, , when response received , continue on processing response see fit

whatever callbackstate delegate, hold response content. that's how know finished.

edit: example docs.

      servicepointmanager.defaultconnectionlimit = 50;       var url = "http://localhost/httptaskserver/default.aspx";        var iterations = 1000;       (int = 0; < iterations; i++)       {         var postparameters = new namevaluecollection();         postparameters.add("data", i.tostring());         httpsocket.postasync(url, postparameters, callbackstate =>           {             if (callbackstate.exception != null)               throw callbackstate.exception;             console.writeline(httpsocket.getresponsetext(callbackstate.responsestream));           });       } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -