{"id":291268,"date":"2018-10-24T11:05:15","date_gmt":"2018-10-24T07:05:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291268"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291268","title":{"rendered":"System.IO.Pipelines: \u0432\u044b\u0441\u043e\u043a\u043e\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 IO \u0432 .NET"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><a href=\"https:\/\/www.nuget.org\/packages\/System.IO.Pipelines\/\">System.IO.Pipelines<\/a> \u2014 \u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430 \u0432 .NET. \u0422\u0440\u0443\u0434\u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u0417\u0430\u0434\u0430\u0447\u0430 System.IO.Pipelines \u2014 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nq\/me\/p-\/nqmep-tqvyyv5nlkpcxjnmlw8z4.jpeg\"><a name=\"habracut\"><\/a><\/p>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443\u0441\u0438\u043b\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 .NET Core, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u043b\u0438\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c Kestrel \u043e\u0434\u043d\u0438\u043c \u0438\u0437 <a href=\"https:\/\/www.techempower.com\/benchmarks\/#section=data-r16&amp;hw=ph&amp;test=plaintext\">\u0441\u0430\u043c\u044b\u0445 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0440\u0430\u0441\u043b\u0438<\/a>. \u041e\u043d\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Kestrel, \u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 API, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 2.1 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 BCL API \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 (System.IO.Pipelines).<\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u043d\u0430 \u0440\u0435\u0448\u0430\u0435\u0442?<\/h2>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0438\u043b\u0438 \u0441\u043e\u043a\u0435\u0442\u0430, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u044e\u0442 \u0438 \u0441\u0430\u043c \u043a\u043e\u0434, \u0438 \u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443.<\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0441\u0435\u0433\u043e\u0434\u043d\u044f?<\/h2>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c TCP-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u0441\u0442\u0440\u043e\u043a (\\n).<\/p>\n<h2>\u0421\u0435\u0440\u0432\u0435\u0440 TCP \u0441 NetworkStream<\/h2>\n<p>  \u041e\u0422\u0421\u0422\u0423\u041f\u041b\u0415\u041d\u0418\u0415: \u043a\u0430\u043a \u0438 \u0432 \u043b\u044e\u0431\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0435\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0434\u0430\u043b\u0435\u0435, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0435\u0441\u043b\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u0435\u043b\u0438\u043a.<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 .NET \u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cs\">\tasync Task ProcessLinesAsync(NetworkStream stream) \t{ \t    var buffer = new byte[1024]; \t    await stream.ReadAsync(buffer, 0, buffer.Length); \t     \t    \/\/ Process a single line from the buffer \t    ProcessLine(buffer); \t}<\/code><\/pre>\n<p>  \u0441\u043c. <a href=\"https:\/\/gist.github.com\/terrajobst\/ee86ab15d1d7a1d5869d1c1f2443f3b3#file-sample1-&lt;i&gt;cs\">sample1.cs<\/a> \u043d\u0430 GitHub<\/p>\n<p>  \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043d\u043e \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0440\u044f\u0434 \u043e\u0448\u0438\u0431\u043e\u043a:<\/p>\n<ul>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 ReadAsync \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438).<\/li>\n<li>\u041e\u043d \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u0430 stream.ReadAsync() \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0443\u0444\u0435\u0440.<\/li>\n<li>\u041a\u043e\u0434 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u0432 \u043e\u0434\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 ReadAsync.<\/li>\n<\/ul>\n<p>  \u042d\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0440\u044f\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\u041d\u0443\u0436\u043d\u043e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430.<\/li>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0432 \u0431\u0443\u0444\u0435\u0440.<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"cs\">\tasync Task ProcessLinesAsync(NetworkStream stream) \t{ \t    var buffer = new byte[1024]; \t    var bytesBuffered = 0; \t    var bytesConsumed = 0; \t  \t    while (true) \t    { \t        var bytesRead = await stream.ReadAsync(buffer, bytesBuffered, buffer.Length - bytesBuffered); \t        if (bytesRead == 0) \t        { \t            \/\/ EOF \t            break; \t        } \t        \/\/ Keep track of the amount of buffered bytes \t        bytesBuffered += bytesRead; \t         \t        var linePosition = -1; \t  \t        do \t        { \t            \/\/ Look for a EOL in the buffered data \t            linePosition = Array.IndexOf(buffer, (byte)'\\n', bytesConsumed, bytesBuffered - bytesConsumed); \t  \t            if (linePosition &gt;= 0) \t            { \t                \/\/ Calculate the length of the line based on the offset \t                var lineLength = linePosition - bytesConsumed; \t  \t                \/\/ Process the line \t                ProcessLine(buffer, bytesConsumed, lineLength); \t  \t                \/\/ Move the bytesConsumed to skip past the line we consumed (including \\n) \t                bytesConsumed += lineLength + 1; \t            } \t        } \t        while (linePosition &gt;= 0); \t    } \t}<\/code><\/pre>\n<p>  \u0441\u043c. <a href=\"https:\/\/gist.github.com\/terrajobst\/8e077db206883ca156dfdb7643969c76#file-&lt;i&gt;sample2-cs\">sample2.cs<\/a> \u043d\u0430 GitHub<\/p>\n<p>  \u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c: \u044d\u0442\u043e \u043c\u043e\u0433\u043b\u043e \u0431\u044b \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u0438\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 1 \u041a\u0431 (1024 \u0431\u0430\u0439\u0442\u0430). \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ArrayPool, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0445 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<pre><code class=\"cs\">\tasync Task ProcessLinesAsync(NetworkStream stream) \t{ \t    byte[] buffer = ArrayPool&lt;byte&gt;.Shared.Rent(1024); \t    var bytesBuffered = 0; \t    var bytesConsumed = 0; \t  \t    while (true) \t    { \t        \/\/ Calculate the amount of bytes remaining in the buffer \t        var bytesRemaining = buffer.Length - bytesBuffered; \t  \t        if (bytesRemaining == 0) \t        { \t            \/\/ Double the buffer size and copy the previously buffered data into the new buffer \t            var newBuffer = ArrayPool&lt;byte&gt;.Shared.Rent(buffer.Length * 2); \t            Buffer.BlockCopy(buffer, 0, newBuffer, 0, buffer.Length); \t            \/\/ Return the old buffer to the pool \t            ArrayPool&lt;byte&gt;.Shared.Return(buffer); \t            buffer = newBuffer; \t            bytesRemaining = buffer.Length - bytesBuffered; \t        } \t  \t        var bytesRead = await stream.ReadAsync(buffer, bytesBuffered, bytesRemaining); \t        if (bytesRead == 0) \t        { \t            \/\/ EOF \t            break; \t        } \t         \t        \/\/ Keep track of the amount of buffered bytes \t        bytesBuffered += bytesRead; \t         \t        do \t        { \t            \/\/ Look for a EOL in the buffered data \t            linePosition = Array.IndexOf(buffer, (byte)'\\n', bytesConsumed, bytesBuffered - bytesConsumed); \t  \t            if (linePosition &gt;= 0) \t            { \t                \/\/ Calculate the length of the line based on the offset \t                var lineLength = linePosition - bytesConsumed; \t  \t                \/\/ Process the line \t                ProcessLine(buffer, bytesConsumed, lineLength); \t  \t                \/\/ Move the bytesConsumed to skip past the line we consumed (including \\n) \t                bytesConsumed += lineLength + 1; \t            } \t        } \t        while (linePosition &gt;= 0); \t    } \t}<\/code><\/pre>\n<p>  <i>\u0441\u043c. <a href=\"https:\/\/gist.github.com\/terrajobst\/568dad7aa8e831cf4fcb48ca370ca251#file-sample3-cs\">sample3.cs<\/a> \u043d\u0430 GitHub<\/i><\/p>\n<p>  \u041a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0435\u0433\u043e \u043a\u043e\u043f\u0438\u0439. \u0422\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043b\u043e\u0433\u0438\u043a\u0430 \u043d\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u0440\u043e\u043a. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0431\u0443\u0444\u0435\u0440\u043e\u0432, \u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u0438\u043d\u043d\u0435\u0435 1 \u041a\u0431.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 1 \u041a\u0431, \u043f\u043e\u043a\u0430 \u043e\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u043e\u043f\u0443\u0441\u0442\u0435\u0435\u0442. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 ReadAsync \u0431\u0443\u0444\u0435\u0440\u044b \u0432\u0441\u0435 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>  \u041c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0431\u0443\u0444\u0435\u0440, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 512 \u0431\u0430\u0439\u0442:<\/p>\n<pre><code class=\"cs\">\tpublic class BufferSegment \t{ \t    public byte[] Buffer { get; set; } \t    public int Count { get; set; } \t  \t    public int Remaining =&gt; Buffer.Length - Count; \t} \t  \tasync Task ProcessLinesAsync(NetworkStream stream) \t{ \t    const int minimumBufferSize = 512; \t  \t    var segments = new List&lt;BufferSegment&gt;(); \t    var bytesConsumed = 0; \t    var bytesConsumedBufferIndex = 0; \t    var segment = new BufferSegment { Buffer = ArrayPool&lt;byte&gt;.Shared.Rent(1024) }; \t  \t    segments.Add(segment); \t  \t    while (true) \t    { \t        \/\/ Calculate the amount of bytes remaining in the buffer \t        if (segment.Remaining &lt; minimumBufferSize) \t        { \t            \/\/ Allocate a new segment \t            segment = new BufferSegment { Buffer = ArrayPool&lt;byte&gt;.Shared.Rent(1024) }; \t            segments.Add(segment); \t        } \t  \t        var bytesRead = await stream.ReadAsync(segment.Buffer, segment.Count, segment.Remaining); \t        if (bytesRead == 0) \t        { \t            break; \t        } \t  \t        \/\/ Keep track of the amount of buffered bytes \t        segment.Count += bytesRead; \t  \t        while (true) \t        { \t            \/\/ Look for a EOL in the list of segments \t            var (segmentIndex, segmentOffset) = IndexOf(segments, (byte)'\\n', bytesConsumedBufferIndex, bytesConsumed); \t  \t            if (segmentIndex &gt;= 0) \t            { \t                \/\/ Process the line \t                ProcessLine(segments, segmentIndex, segmentOffset); \t  \t                bytesConsumedBufferIndex = segmentOffset; \t                bytesConsumed = segmentOffset + 1; \t            } \t            else \t            { \t                break; \t            } \t        } \t  \t        \/\/ Drop fully consumed segments from the list so we don't look at them again \t        for (var i = bytesConsumedBufferIndex; i &gt;= 0; --i) \t        { \t            var consumedSegment = segments[i]; \t            \/\/ Return all segments unless this is the current segment \t            if (consumedSegment != segment) \t            { \t                ArrayPool&lt;byte&gt;.Shared.Return(consumedSegment.Buffer); \t                segments.RemoveAt(i); \t            } \t        } \t    } \t} \t  \t(int segmentIndex, int segmentOffest) IndexOf(List&lt;BufferSegment&gt; segments, byte value, int startBufferIndex, int startSegmentOffset) \t{ \t    var first = true; \t    for (var i = startBufferIndex; i &lt; segments.Count; ++i) \t    { \t        var segment = segments[i]; \t        \/\/ Start from the correct offset \t        var offset = first ? startSegmentOffset : 0; \t        var index = Array.IndexOf(segment.Buffer, value, offset, segment.Count - offset); \t  \t        if (index &gt;= 0) \t        { \t            \/\/ Return the buffer index and the index within that segment where EOL was found \t            return (i, index); \t        } \t  \t        first = false; \t    } \t    return (-1, -1); \t}<\/code><\/pre>\n<p>  <i>\u0441\u043c. <a href=\"https:\/\/gist.github.com\/terrajobst\/aed8731297b8e8268ae6a37ebfc33146#file-sample4-cs\">sample4.cs<\/a> \u043d\u0430 GitHub<\/i><\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043a\u043e\u0434 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442\u0441\u044f. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u043c\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0431\u0443\u0444\u0435\u0440\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f List, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0441\u0442\u0440\u043e\u043a. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 ProcessLine \u0438 IndexOf \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c List \u0432\u043c\u0435\u0441\u0442\u043e byte[], offset \u0438 count. \u041b\u043e\u0433\u0438\u043a\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043d\u0430\u0447\u043d\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0431\u0443\u0444\u0435\u0440\u0430 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e.<br \/>  \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u0440\u044f\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n<ol>\n<li>\u0418\u0437 ArrayPoolbyte \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e Byte[] \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ReadAsync \u0438\u043b\u0438 WriteAsync \u0441\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u0447\u0442\u043e\u0431\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 API \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b). \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f, \u044d\u0442\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u043c\u0443\u0441\u043e\u0440\u0430 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0443\u043b\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u043e\u043b\u0433\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/li>\n<li>\u041f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0443\u044e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043b\u043e\u0433\u0438\u043a\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043e\u0431\u044a\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0431\u043b\u043e\u043a\u0438 \u0431\u0443\u0444\u0435\u0440\u043e\u0432, \u0430 \u043d\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u043e\u0434 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435:\n<ul>\n<li>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u0446\u0438\u043a\u043b\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u044b.<\/li>\n<li>\u041d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b.<\/li>\n<li>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0446\u0438\u043a\u043b \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u044b\u0441\u0442\u0440\u043e. \u041d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0446\u0438\u043a\u043b \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043d\u0435 \u043f\u043e\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u0437\u0430 \u043d\u0438\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u00ab\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c\u00bb \u0438\u043b\u0438 \u00ab\u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u0443\u00bb.<\/li>\n<li>\u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0431\u043e\u0440 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u0446\u0438\u043a\u043b\u043e\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u0438 \u0446\u0438\u043a\u043b\u043e\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445.<\/li>\n<li>\u041b\u043e\u0433\u0438\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043a\u043e\u0434\u0430: \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0443\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u043c \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0443\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430.<\/li>\n<li>\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c\u0438 \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0418\u043d\u0430\u0447\u0435 \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c \u0431\u0443\u0444\u0435\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043b\u043e\u0433\u0438\u043a\u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u043e\u043a\u0435\u0442\u0430.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>  \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0437\u0430\u0448\u043a\u0430\u043b\u0438\u0432\u0430\u0442\u044c (\u0430 \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438!). \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  \u0426\u0435\u043b\u044c System.IO.Pipelines \u2014 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443.<\/p>\n<h4>TCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 System.IO.Pipelines<\/h4>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 System.IO.Pipelines:<\/p>\n<pre><code class=\"cs\">\tasync Task ProcessLinesAsync(Socket socket) \t{ \t    var pipe = new Pipe(); \t    Task writing = FillPipeAsync(socket, pipe.Writer); \t    Task reading = ReadPipeAsync(pipe.Reader); \t  \t    return Task.WhenAll(reading, writing); \t} \t  \tasync Task FillPipeAsync(Socket socket, PipeWriter writer) \t{ \t    const int minimumBufferSize = 512; \t  \t    while (true) \t    { \t        \/\/ Allocate at least 512 bytes from the PipeWriter \t        Memory&lt;byte&gt; memory = writer.GetMemory(minimumBufferSize); \t        try  \t        { \t            int bytesRead = await socket.ReceiveAsync(memory, SocketFlags.None); \t            if (bytesRead == 0) \t            { \t                break; \t            } \t            \/\/ Tell the PipeWriter how much was read from the Socket \t            writer.Advance(bytesRead); \t        } \t        catch (Exception ex) \t        { \t            LogError(ex); \t            break; \t        } \t  \t        \/\/ Make the data available to the PipeReader \t        FlushResult result = await writer.FlushAsync(); \t  \t        if (result.IsCompleted) \t        { \t            break; \t        } \t    } \t  \t    \/\/ Tell the PipeReader that there's no more data coming \t    writer.Complete(); \t} \t  \tasync Task ReadPipeAsync(PipeReader reader) \t{ \t    while (true) \t    { \t        ReadResult result = await reader.ReadAsync(); \t  \t        ReadOnlySequence&lt;byte&gt; buffer = result.Buffer; \t        SequencePosition? position = null; \t  \t        do  \t        { \t            \/\/ Look for a EOL in the buffer \t            position = buffer.PositionOf((byte)'\\n'); \t  \t            if (position != null) \t            { \t                \/\/ Process the line \t                ProcessLine(buffer.Slice(0, position.Value)); \t                 \t                \/\/ Skip the line + the \\n character (basically position) \t                buffer = buffer.Slice(buffer.GetPosition(1, position.Value)); \t            } \t        } \t        while (position != null); \t  \t        \/\/ Tell the PipeReader how much of the buffer we have consumed \t        reader.AdvanceTo(buffer.Start, buffer.End); \t  \t        \/\/ Stop reading if there's no more data coming \t        if (result.IsCompleted) \t        { \t            break; \t        } \t    } \t  \t    \/\/ Mark the PipeReader as complete \t    reader.Complete(); \t}<\/code><\/pre>\n<p>  <i>\u0441\u043c. <a href=\"https:\/\/gist.github.com\/terrajobst\/7e04b424ab279e711eece8f6b1c233d8#file-sample5-cs\">sample5.cs<\/a> \u043d\u0430 GitHub<\/i><\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u0442\u0440\u043e\u043a \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0446\u0438\u043a\u043b\u0430:<\/p>\n<ul>\n<li>FillPipeAsync \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 PipeWriter.<\/li>\n<li>ReadPipeAsync \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437 PipeReader \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.<\/li>\n<\/ul>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432. \u042d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 System.IO.Pipelines. \u0412\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c PipeReader\/PipeWriter.<\/p>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f: \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u0434 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f PipeWriter.GetMemory(int), \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u0435\u043b\u044f. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f PipeWriter.Advance(int), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 PipeWriter, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0431\u0443\u0444\u0435\u0440. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 PipeWriter.FlushAsync(), \u0447\u0442\u043e\u0431\u044b PipeReader \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u0446\u0438\u043a\u043b \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b PipeWriter, \u043d\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043e\u0442 \u0441\u043e\u043a\u0435\u0442\u0430. \u041a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u043a PipeReader.ReadAsync(), \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c ReadResult, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0434\u0432\u0430 \u0432\u0430\u0436\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f: \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0435 ReadOnlySequence, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 IsCompleted, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u0435\u043b\u044e, \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0443 (EOF). \u041a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 (EOL) \u0438 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430, \u043c\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u0431\u0443\u0444\u0435\u0440 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0443\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f PipeReader.AdvanceTo, \u0438 \u043e\u043d \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 PipeReader, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u044b\u043b\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u043e.<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u0435\u043b\u044f, \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u0435\u043b\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u0432\u044b\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u0432\u0441\u044e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<h2>System.IO.Pipelines<\/h2>\n<p>  <\/p>\n<h4>\u0427\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e System.IO.Pipelines \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0432\u0430\u0436\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e: \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0430\u043d\u0430\u043b\u0435, \u043d\u043e \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0438\u0445.<\/p>\n<p>  \u0423 PipeReader \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 API: ReadAsync \u0438 AdvanceTo. ReadAsync \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430, AdvanceTo \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 PipeReader \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u0438 \u0431\u0443\u0444\u0435\u0440\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u0435\u043b\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u043f\u0443\u043b).<\/p>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 HTTP, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043d\u0430\u043b\u0430, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9c\/lp\/d8\/9clpd8h1r6b1m1jrwultkuggw6i.png\"><\/p>\n<h2>ReadOnlySequenceT<\/h2>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u043e\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043c\u0435\u0436\u0434\u0443 PipeWriter \u0438 PipeReader. PipeReader.ReadAsync \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 ReadOnlySequence, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c BCL \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 ReadOnlyMemory&lt;\u0422&gt;. \u041e\u043d \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 Span \u0438\u043b\u0438 Memory, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0438 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/79\/y0\/kw\/79y0kwylohggq941soblji6qd2o.png\"><\/p>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u043d\u0430\u043b\u0430 \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0433\u0434\u0435 \u0432 \u043e\u0431\u0449\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u0435\u043b\u044c \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u0435\u043b\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442 \u0438\u0445 \u043f\u043e \u043c\u0435\u0440\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. SequencePosition \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0435\u0434\u0438\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0432 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f ReadOnlySequence&lt;\u0422&gt;.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 ReadOnlySequence&lt;\u0422&gt; \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0438 \u0431\u043e\u043b\u0435\u0435, \u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u0442\u0435\u0439 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0443\u044e ASCII ReadOnlySequence \u0432 \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"cs\">\tstring GetAsciiString(ReadOnlySequence&lt;byte&gt; buffer) \t{ \t    if (buffer.IsSingleSegment) \t    { \t        return Encoding.ASCII.GetString(buffer.First.Span); \t    } \t  \t    return string.Create((int)buffer.Length, buffer, (span, sequence) =&gt; \t    { \t        foreach (var segment in sequence) \t        { \t            Encoding.ASCII.GetChars(segment.Span, span); \t  \t            span = span.Slice(segment.Length); \t        } \t    }); \t}<\/code><\/pre>\n<p>  \u0441\u043c. <a href=\"https:\/\/gist.github.com\/terrajobst\/6e1bea5bec4591edd7c5fe5416ce7f56#file-sample6-cs\">sample6.cs<\/a> \u043d\u0430 GitHub  <\/p>\n<h4>\u0421\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0443 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u043c<\/h4>\n<p>  \u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e: \u043f\u043e\u0442\u043e\u043a \u0447\u0442\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0435\u0442\u0438 \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442 \u0438\u0445 \u0432 \u0431\u0443\u0444\u0435\u0440\u044b, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044b\u0447\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0435\u0442\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0442\u043e\u043a \u0447\u0442\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a \u0447\u0442\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043b\u0438\u0431\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443, \u043b\u0438\u0431\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u043f\u0430\u0443\u0437 \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445: PauseWriterThreshold \u0438 ResumeWriterThreshold. PauseWriterThreshold \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 PipeWriter.FlushAsync. ResumeWriterThreshold \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u044c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qf\/yj\/5u\/qfyj5u6aahkadlp8nk1gtc9bqr4.png\"><\/p>\n<p>  PipeWriter.FlushAsync \u00ab\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f\u00bb, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u0442 \u043b\u0438\u043c\u0438\u0442, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 PauseWriterThreshold, \u0438 \u00ab\u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f\u00bb, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0438\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432 ResumeWriterThreshold. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043b\u0438\u043c\u0438\u0442\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430<\/h4>\n<p>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 async\/await \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0432 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u043f\u0443\u043b\u0430, \u043b\u0438\u0431\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c SynchronizationContext.<\/p>\n<p>  \u041f\u0440\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u0438 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0442\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0433\u0434\u0435 \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u044d\u0448 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u042d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u044b. System.IO.Pipelines \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 PipeScheduler, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0442\u043e\u0447\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u2014 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 Kestrel Libuv, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043a\u0430\u043d\u0430\u043b\u0430\u043c \u0446\u0438\u043a\u043b\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n<h2>\u0415\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 PipeReader<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u00ab\u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0431\u0435\u0437 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438\u00bb: \u0431\u0443\u0444\u0435\u0440 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0422\u0430\u043a, \u0432 Linux \u0441 epoll \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0443\u0444\u0435\u0440 \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438.<\/li>\n<li>\u041a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430: \u043b\u043e\u0433\u0438\u043a\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0430 \u043e\u0442 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0438 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u044d\u0442\u0443 \u043b\u043e\u0433\u0438\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0431\u0443\u0444\u0435\u0440\u0430\u0445 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u0435\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437 \u0441\u0435\u0442\u0438. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. ASP.NET Core \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 http-\u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 Kestrel.<\/li>\n<li>\u0421\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u041e\u0421 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 API \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 Windows), \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f PipeReader \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u044b.<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0414\u0440\u0443\u0433\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b<\/h4>\n<p>  \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 System.IO.Pipelines \u0440\u044f\u0434 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 BCL:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.buffers.memorypool-1?view=netcore-2.1\">MemoryPoolT<\/a>, <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.buffers.imemoryowner-1?view=netcore-2.1\">IMemoryOwnerT<\/a>, <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.buffers.memorymanager-1?view=netcore-2.1\">MemoryManagerT<\/a>. \u0412 .NET Core 1.0 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.buffers.arraypool-1?view=netcore-2.1\">ArrayPoolT<\/a>, \u0430 \u0432 .NET Core 2.1 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0443\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043b\u044e\u0431\u044b\u043c\u0438 MemoryT. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0441\u0442\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432).<\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.buffers.ibufferwriter-1?view=netcore-2.1\">IBufferWriterT<\/a> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f PipeWriter).<\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.threading.tasks.sources.ivaluetasksource-1?view=netcore-2.1\">IValueTaskSource<\/a> \u2014 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.threading.tasks.valuetask-1?view=netcore-2.1\">ValueTaskT<\/a> \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 .NET Core 1.1, \u043d\u043e \u0432 .NET Core 2.1 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0431\u0435\u0441\u043f\u0435\u0440\u0435\u0431\u043e\u0439\u043d\u044b\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0441\u043c. <a href=\"https:\/\/github.com\/dotnet\/corefx\/issues\/27445\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b?<\/h2>\n<p>  API \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 nuget-\u043f\u0430\u043a\u0435\u0442\u0435 <a href=\"https:\/\/www.nuget.org\/packages\/System.IO.Pipelines\/\">System.IO.Pipelines<\/a>.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 .NET Server 2.1, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (\u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435) \u0441\u043c. <a href=\"https:\/\/github.com\/davidfowl\/TcpEcho\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e dotnet run (\u0438\u043b\u0438 Visual Studio). \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u0441\u043e\u043a\u0435\u0442\u0430 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 8087, \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u0440\u0442\u0443 8087 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 netcat \u0438\u043b\u0438 putty. \u041e\u0442\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Kestrel \u0438 SignalR, \u0438 \u043c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0439\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 .NET \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/company\/microsoft\/blog\/423105\/\"> https:\/\/habr.com\/company\/microsoft\/blog\/423105\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\"><a href=\"https:\/\/www.nuget.org\/packages\/System.IO.Pipelines\/\">System.IO.Pipelines<\/a> \u2014 \u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430 \u0432 .NET. \u0422\u0440\u0443\u0434\u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u0417\u0430\u0434\u0430\u0447\u0430 System.IO.Pipelines \u2014 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nq\/me\/p-\/nqmep-tqvyyv5nlkpcxjnmlw8z4.jpeg\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-291268","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=291268"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291268\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}