Can not find an example of using this method. How much I could understand, it is needed in order to expect a connection without generating additional threads. His work will become noticeable, for example, in such a situation: Several clients turn to the server, and the first one sends a large amount of data, then, if you do not use this method, all other clients will have to wait until the first one completes the transfer. Please correct if I'm wrong. And I would very much like to see a correct example of using the method, since it is not even clear how to launch it, because it is impossible to launch it in an infinite loop as usual GetContext ().
- There are many examples of "an example of using an asynchronous procedure". They all look alike. - nick_n_a
- @nick_n_a I have a problem with this one, I see many examples of how to work with regular HTTPListener.GetContext (), but I can’t find anything about GetContextAsync (). - Konstantin Galiakhmetov
- @nick_n_a For example, GetContext is often called in an infinite loop, but I don’t understand how to deal with its asynchronous version. - Konstantin Galiakhmetov
- Once again I am writing to you, read the "asynchronous call", for example msdn.microsoft.com/ru-ru/library/2e08f6yc%28v=vs.110%29.aspx - nick_n_a
- @nick_n_a Unfortunately, it’s not obvious to me how to relate to my question, could you rewrite the following code using the asynchronous version of the method: while (true) {var context == listener.GetContext (); Task.run (() => HandleContext (context)); } - Konstantin Galiakhmetov
|