{"id":425928,"date":"2024-07-10T09:02:32","date_gmt":"2024-07-10T09:02:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=425928"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=425928","title":{"rendered":"<span>\u00ab\u041d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435\u00bb \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 TCP-\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 desktop-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 .NET \u0434\u043b\u044f Windows<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0437\u0430\u0434 \u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0431\u043e\u0438\u0442\u044c desktop-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e &#8212; \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u0432.<\/p>\n<p>\u0418 \u043b\u0438\u0448\u044c \u0441\u043f\u0443\u0441\u0442\u044f \u0432\u0440\u0435\u043c\u044f \u043e\u0434\u0438\u043d \u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u0447\u043b\u0435\u043d \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c Wireshark, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e. \u041f\u043e\u0441\u043b\u0435 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u0438, \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/p>\n<p>\u042d\u0442\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Wireshark \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 .NET Framework \/ .NET 5+ \u0434\u043b\u044f Windows \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 (retransmitted) \u0438 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 (reordered) \u0431\u0430\u0439\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e).<\/p>\n<p>\u0412\u043f\u043e\u043b\u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0438 \u0432\u0430\u043c &#8212; \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0435 \u0438\u043b\u0438 &#171;\u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435&#187; TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u043f\u043e \u0442\u0438\u043f\u0443 Twitter Streaming API).<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c!<\/p>\n<h2>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c TCP-\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043d\u0430 Windows 10<\/h2>\n<p>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441 <a href=\"https:\/\/stackoverflow.com\/questions\/59368554\/access-tcp-retransmitted-byte-count-and-retransmitted-packet-count-for-a-given\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 stackoverflow, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0430\u0432\u0442\u043e\u0440 \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0447 TCP \u043f\u0430\u043a\u0435\u0442\u0430 (TCP Retransmission)<\/a>. <\/p>\n<p>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e, \u0447\u0442\u043e \u0432 <strong>Windows 10, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 Creators Update (1703), \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f TCP-\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0441\u043e\u043a\u0435\u0442\u0443, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 TCP_INFO \u0432 Linux<\/strong>. <\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 WinAPI-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/learn.microsoft.com\/ru-ru\/windows\/win32\/api\/winsock2\/nf-winsock2-wsaioctl\" rel=\"noopener noreferrer nofollow\">WSAIoctl<\/a> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p><em>\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0441\u043e\u043a\u0435\u0442\u0430<\/em>,<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/winsock\/sio-tcp-info\" rel=\"noopener noreferrer nofollow\"><em>SIO_TCP_INFO<\/em><\/a> (\u043a\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 TCP),<\/p>\n<\/li>\n<li>\n<p><em>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 4 \u0431\u0430\u0439\u0442\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e 0<\/em> (\u044d\u0442\u043e \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435, \u0447\u0442\u043e \u0432 \u043e\u0442\u0432\u0435\u0442 \u043c\u044b \u0436\u0434\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/mstcpip\/ns-mstcpip-tcp_info_v0\" rel=\"noopener noreferrer nofollow\">TCP_INFO_v0<\/a>),<\/p>\n<\/li>\n<li>\n<p><em>4<\/em> (\u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430),<\/p>\n<\/li>\n<li>\n<p><em>\u0431\u0443\u0444\u0435\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 (<\/em>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442),<\/p>\n<\/li>\n<li>\n<p><em>88<\/em> (\u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/mstcpip\/ns-mstcpip-tcp_info_v0\" rel=\"noopener noreferrer nofollow\">TCP_INFO_v0<\/a>)<\/p>\n<\/li>\n<li>\n<p><em>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 4 \u0431\u0430\u0439\u0442\u0430<\/em> (\u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0442\u0443\u0434\u0430 \u0432\u0435\u0440\u043d1\u0442\u0441\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430),<\/p>\n<\/li>\n<li>\n<p>[\u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c 0]. <\/p>\n<\/li>\n<\/ul>\n<p>\u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043e\u043a\u0435\u0442\u0443.<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c: <\/p>\n<ul>\n<li>\n<p><em>State<\/em> &#8212; \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 TCP-\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f,<\/p>\n<\/li>\n<li>\n<p><em>ConnectionTimeMs<\/em> &#8212; \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445),<\/p>\n<\/li>\n<li>\n<p><em>BytesOut<\/em> \u0438 <em>BytesIn<\/em> &#8212; \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e,<\/p>\n<\/li>\n<li>\n<p>BytesReordered &#8212; \u0447\u0438\u0441\u043b\u043e \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 (TCP Reordering),<\/p>\n<\/li>\n<li>\n<p>BytesRetrans &#8212; \u0447\u0438\u0441\u0442\u043e \u0431\u0430\u0439\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b (TCP Retransmission),<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0432\u0438\u0448\u0435\u043d\u043a\u0430 \u043d\u0430 \u0442\u043e\u0440\u0442\u0435 &#8212; \u0432 .NET \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Socket \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 SIO_TCP_INFO \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f WinAPI-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0442\u043e\u0434\u0443 <a href=\"https:\/\/learn.microsoft.com\/ru-ru\/dotnet\/api\/system.net.sockets.socket.iocontrol?view=net-8.0\" rel=\"noopener noreferrer nofollow\">Socket.IOControl<\/a>.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 Socket \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u0433\u043e TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043d\u0443\u0442:<\/p>\n<pre><code class=\"cs\">#nullable enable  \/\/\/ &lt;summary> \/\/\/ \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f TCP-\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0441\u043e\u043a\u0435\u0442\u0443. \/\/\/ &lt;\/summary> public static unsafe class WinTcpInfo {     private const int SIO_TCP_INFO = unchecked((int)0xD8000027);      private static readonly byte[] ZeroInValue = BitConverter.GetBytes(0);      public static TcpInfoV0? GetTcpInfoV0(Socket socket)     {         var optionOutValue = new byte[sizeof(TcpInfoV0)];          if (socket.IOControl(SIO_TCP_INFO, ZeroInValue, optionOutValue) &lt;= 0)             return null;          var handle = GCHandle.Alloc(optionOutValue, GCHandleType.Pinned);         var result = Marshal.PtrToStructure&lt;TcpInfoV0>(handle.AddrOfPinnedObject());         handle.Free();         return result;     } }<\/code><\/pre>\n<p>\u0418 \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043b\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043a\u0435\u0442\u0443. <\/p>\n<p>\u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442.<\/p>\n<h2>\u041a\u0430\u043a &#171;\u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u043e&#187; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a Socket-\u0443 \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/h2>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u0440\u043e\u043c\u0435 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u0437\u0430 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0439\u0442\u0438\/\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p><em>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043f\u0440\u044f\u043c\u044b\u0445 \u0440\u0443\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <\/em><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.net.http.winhttphandler\" rel=\"noopener noreferrer nofollow\"><em>WinHttpHandler<\/em><\/a><em> \u0438\u043b\u0438 \u0438\u043d\u044b\u0445 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0435\u0439, \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0432\u0430\u043c\u0438 \u0441\u043e\u043a\u0435\u0442\u0430\u0445. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0440\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043d\u0438\u043c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0432 .NET Framework, \u0447\u0442\u043e \u0432 .NET 5+, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Socket &#171;\u0441\u043a\u0440\u044b\u0442\u0430&#187; \u0432\u043d\u0443\u0442\u0440\u0438 Stream-\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Stream \u0447\u0435\u0440\u0435\u0437 WebRequest<\/p>\n<pre><code class=\"cs\">var webRequest = WebRequest.Create(url); var webResponse = await webRequest.GetResponseAsync(); var stream = webResponse.GetResponseStream();<\/code><\/pre>\n<p>\u0438 \u0447\u0435\u0440\u0435\u0437 HttpClient<\/p>\n<pre><code class=\"cs\">var requestMessage = new HttpRequestMessage(HttpMethod.Get, url); var responseMessage = await httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead); var stream = await responseMessage.Content.ReadAsStreamAsync();<\/code><\/pre>\n<p>\u0418 \u0442\u0430\u043c \u0438 \u0442\u0430\u043c, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043f\u0430\u0440\u044b \u0441\u0442\u0440\u043e\u043a. \u041f\u0440\u0430\u0432\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0438\u043c\u0435\u044e\u0442 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b.<\/p>\n<p>\u0412 .NET 5+ \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (HttpClient \u0438\u043b\u0438 WebRequest), \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 stream \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c \u0442\u0438\u043f\u0430 System.Net.Http.HttpContentStream, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 _connection (\u0442\u0438\u043f\u0430 HttpConnection), \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 _socket \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u0441\u043e\u043a\u0435\u0442\u043e\u043c.<\/p>\n<p>\u0418 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f Socket-\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c: <\/p>\n<pre><code class=\"cs\">private static readonly Type HttpContentStreamType = Type.GetType(\"System.Net.Http.HttpContentStream, System.Net.Http\")!; private static readonly FieldInfo HttpContentStreamConnectionField =     HttpContentStreamType.GetField(\"_connection\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)!; private static readonly Type HttpConnectionType = Type.GetType(\"System.Net.Http.HttpConnection, System.Net.Http\")!; private static readonly FieldInfo HttpConnectionSocketField =     HttpConnectionType.GetField(\"_socket\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)!;  private static Socket? GetSocketFromStream(Stream? stream) {     if (HttpContentStreamType.IsInstanceOfType(stream))     {         var httpConnection = HttpContentStreamConnectionField.GetValue(stream);         if (httpConnection == null)             return null;          return (Socket?)HttpConnectionSocketField.GetValue(httpConnection);     }      return null; }<\/code><\/pre>\n<p>\u0412 .NET Framework \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435: WebRequest \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u0438\u043f\u0443 System.Net.ConnectStream, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 internal \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e InternalSocket. \u0410 \u0432\u043e\u0442 HttpClient \u0435\u0449\u0451 \u0438 &#171;\u043e\u0431\u0435\u0440\u043d\u0451\u0442&#187; ConnectStream \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0430\u043c\u0438: System.Net.Http.DelegatingStream \u0438 System.Net.Http.HttpClientHandler+WebExceptionWrapperStream.<\/p>\n<p>\u0412\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434 \u0431\u044b\u043b \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0434\u043b\u044f .NET 4.7.2, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f .NET 8.<\/p>\n<p><a href=\"https:\/\/github.com\/SLenik\/dotnet-tcp-info\/blob\/master\/\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u043c\u043e\u0451\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 github<\/a>.<\/p>\n<p><strong>\u0410 \u0431\u044b\u043b\u0438 \u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0435\u0442\u044c\u044e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0441\u0431\u043e\u044f \u0432 \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435? \u041f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445<\/strong><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/827118\/\"> https:\/\/habr.com\/ru\/articles\/827118\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0437\u0430\u0434 \u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0431\u043e\u0438\u0442\u044c desktop-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e &#8212; \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u0432.<\/p>\n<p>\u0418 \u043b\u0438\u0448\u044c \u0441\u043f\u0443\u0441\u0442\u044f \u0432\u0440\u0435\u043c\u044f \u043e\u0434\u0438\u043d \u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u0447\u043b\u0435\u043d \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c Wireshark, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e. \u041f\u043e\u0441\u043b\u0435 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u0438, \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/p>\n<p>\u042d\u0442\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Wireshark \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 .NET Framework \/ .NET 5+ \u0434\u043b\u044f Windows \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 (retransmitted) \u0438 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 (reordered) \u0431\u0430\u0439\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e).<\/p>\n<p>\u0412\u043f\u043e\u043b\u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0438 \u0432\u0430\u043c &#8212; \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0435 \u0438\u043b\u0438 &#171;\u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435&#187; TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u043f\u043e \u0442\u0438\u043f\u0443 Twitter Streaming API).<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c!<\/p>\n<h2>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c TCP-\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043d\u0430 Windows 10<\/h2>\n<p>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441 <a href=\"https:\/\/stackoverflow.com\/questions\/59368554\/access-tcp-retransmitted-byte-count-and-retransmitted-packet-count-for-a-given\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 stackoverflow, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0430\u0432\u0442\u043e\u0440 \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0447 TCP \u043f\u0430\u043a\u0435\u0442\u0430 (TCP Retransmission)<\/a>. <\/p>\n<p>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e, \u0447\u0442\u043e \u0432 <strong>Windows 10, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 Creators Update (1703), \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f TCP-\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0441\u043e\u043a\u0435\u0442\u0443, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 TCP_INFO \u0432 Linux<\/strong>. <\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 WinAPI-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/learn.microsoft.com\/ru-ru\/windows\/win32\/api\/winsock2\/nf-winsock2-wsaioctl\" rel=\"noopener noreferrer nofollow\">WSAIoctl<\/a> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p><em>\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0441\u043e\u043a\u0435\u0442\u0430<\/em>,<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/winsock\/sio-tcp-info\" rel=\"noopener noreferrer nofollow\"><em>SIO_TCP_INFO<\/em><\/a> (\u043a\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 TCP),<\/p>\n<\/li>\n<li>\n<p><em>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 4 \u0431\u0430\u0439\u0442\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e 0<\/em> (\u044d\u0442\u043e \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435, \u0447\u0442\u043e \u0432 \u043e\u0442\u0432\u0435\u0442 \u043c\u044b \u0436\u0434\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/mstcpip\/ns-mstcpip-tcp_info_v0\" rel=\"noopener noreferrer nofollow\">TCP_INFO_v0<\/a>),<\/p>\n<\/li>\n<li>\n<p><em>4<\/em> (\u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430),<\/p>\n<\/li>\n<li>\n<p><em>\u0431\u0443\u0444\u0435\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 (<\/em>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442),<\/p>\n<\/li>\n<li>\n<p><em>88<\/em> (\u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/mstcpip\/ns-mstcpip-tcp_info_v0\" rel=\"noopener noreferrer nofollow\">TCP_INFO_v0<\/a>)<\/p>\n<\/li>\n<li>\n<p><em>\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 4 \u0431\u0430\u0439\u0442\u0430<\/em> (\u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0442\u0443\u0434\u0430 \u0432\u0435\u0440\u043d1\u0442\u0441\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430),<\/p>\n<\/li>\n<li>\n<p>[\u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c 0]. <\/p>\n<\/li>\n<\/ul>\n<p>\u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043e\u043a\u0435\u0442\u0443.<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c: <\/p>\n<ul>\n<li>\n<p><em>State<\/em> &#8212; \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 TCP-\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f,<\/p>\n<\/li>\n<li>\n<p><em>ConnectionTimeMs<\/em> &#8212; \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445),<\/p>\n<\/li>\n<li>\n<p><em>BytesOut<\/em> \u0438 <em>BytesIn<\/em> &#8212; \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e,<\/p>\n<\/li>\n<li>\n<p>BytesReordered &#8212; \u0447\u0438\u0441\u043b\u043e \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 (TCP Reordering),<\/p>\n<\/li>\n<li>\n<p>BytesRetrans &#8212; \u0447\u0438\u0441\u0442\u043e \u0431\u0430\u0439\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b (TCP Retransmission),<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0432\u0438\u0448\u0435\u043d\u043a\u0430 \u043d\u0430 \u0442\u043e\u0440\u0442\u0435 &#8212; \u0432 .NET \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Socket \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 SIO_TCP_INFO \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f WinAPI-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0442\u043e\u0434\u0443 <a href=\"https:\/\/learn.microsoft.com\/ru-ru\/dotnet\/api\/system.net.sockets.socket.iocontrol?view=net-8.0\" rel=\"noopener noreferrer nofollow\">Socket.IOControl<\/a>.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 Socket \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u0433\u043e TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043d\u0443\u0442:<\/p>\n<pre><code class=\"cs\">#nullable enable  \/\/\/ &lt;summary> \/\/\/ \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f TCP-\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0441\u043e\u043a\u0435\u0442\u0443. \/\/\/ &lt;\/summary> public static unsafe class WinTcpInfo {     private const int SIO_TCP_INFO = unchecked((int)0xD8000027);      private static readonly byte[] ZeroInValue = BitConverter.GetBytes(0);      public static TcpInfoV0? GetTcpInfoV0(Socket socket)     {         var optionOutValue = new byte[sizeof(TcpInfoV0)];          if (socket.IOControl(SIO_TCP_INFO, ZeroInValue, optionOutValue) &lt;= 0)             return null;          var handle = GCHandle.Alloc(optionOutValue, GCHandleType.Pinned);         var result = Marshal.PtrToStructure&lt;TcpInfoV0>(handle.AddrOfPinnedObject());         handle.Free();         return result;     } }<\/code><\/pre>\n<p>\u0418 \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043b\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043a\u0435\u0442\u0443. <\/p>\n<p>\u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442.<\/p>\n<h2>\u041a\u0430\u043a &#171;\u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u043e&#187; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a Socket-\u0443 \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/h2>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u0440\u043e\u043c\u0435 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u0437\u0430 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0439\u0442\u0438\/\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p><em>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043f\u0440\u044f\u043c\u044b\u0445 \u0440\u0443\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <\/em><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.net.http.winhttphandler\" rel=\"noopener noreferrer nofollow\"><em>WinHttpHandler<\/em><\/a><em> \u0438\u043b\u0438 \u0438\u043d\u044b\u0445 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0435\u0439, \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0432\u0430\u043c\u0438 \u0441\u043e\u043a\u0435\u0442\u0430\u0445. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0440\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043d\u0438\u043c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0432 .NET Framework, \u0447\u0442\u043e \u0432 .NET 5+, \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Socket &#171;\u0441\u043a\u0440\u044b\u0442\u0430&#187; \u0432\u043d\u0443\u0442\u0440\u0438 Stream-\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Stream \u0447\u0435\u0440\u0435\u0437 WebRequest<\/p>\n<pre><code class=\"cs\">var webRequest = WebRequest.Create(url); var webResponse = await webRequest.GetResponseAsync(); var stream = webResponse.GetResponseStream();<\/code><\/pre>\n<p>\u0438 \u0447\u0435\u0440\u0435\u0437 HttpClient<\/p>\n<pre><code class=\"cs\">var requestMessage = new HttpRequestMessage(HttpMethod.Get, url); var responseMessage = await httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead); var stream = await responseMessage.Content.ReadAsStreamAsync();<\/code><\/pre>\n<p>\u0418 \u0442\u0430\u043c \u0438 \u0442\u0430\u043c, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043f\u0430\u0440\u044b \u0441\u0442\u0440\u043e\u043a. \u041f\u0440\u0430\u0432\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0438\u043c\u0435\u044e\u0442 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b.<\/p>\n<p>\u0412 .NET 5+ \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (HttpClient \u0438\u043b\u0438 WebRequest), \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 stream \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c \u0442\u0438\u043f\u0430 System.Net.Http.HttpContentStream, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 _connection (\u0442\u0438\u043f\u0430 HttpConnection), \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 _socket \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u0441\u043e\u043a\u0435\u0442\u043e\u043c.<\/p>\n<p>\u0418 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f Socket-\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c: <\/p>\n<pre><code class=\"cs\">private static readonly Type HttpContentStreamType = Type.GetType(\"System.Net.Http.HttpContentStream, System.Net.Http\")!; private static readonly FieldInfo HttpContentStreamConnectionField =     HttpContentStreamType.GetField(\"_connection\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)!; private static readonly Type HttpConnectionType = Type.GetType(\"System.Net.Http.HttpConnection, System.Net.Http\")!; private static readonly FieldInfo HttpConnectionSocketField =     HttpConnectionType.GetField(\"_socket\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)!;  private static Socket? GetSocketFromStream(Stream? stream) {     if (HttpContentStreamType.IsInstanceOfType(stream))     {         var httpConnection = HttpContentStreamConnectionField.GetValue(stream);         if (httpConnection == null)             return null;          return (Socket?)HttpConnectionSocketField.GetValue(httpConnection);     }      return null; }<\/code><\/pre>\n<p>\u0412 .NET Framework \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435: WebRequest \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u0438\u043f\u0443 System.Net.ConnectStream, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 internal \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e InternalSocket. \u0410 \u0432\u043e\u0442 HttpClient \u0435\u0449\u0451 \u0438 &#171;\u043e\u0431\u0435\u0440\u043d\u0451\u0442&#187; ConnectStream \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0430\u043c\u0438: System.Net.Http.DelegatingStream \u0438 System.Net.Http.HttpClientHandler+WebExceptionWrapperStream.<\/p>\n<p>\u0412\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434 \u0431\u044b\u043b \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0434\u043b\u044f .NET 4.7.2, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f .NET 8.<\/p>\n<p><a href=\"https:\/\/github.com\/SLenik\/dotnet-tcp-info\/blob\/master\/\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u043c\u043e\u0451\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 github<\/a>.<\/p>\n<p><strong>\u0410 \u0431\u044b\u043b\u0438 \u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0435\u0442\u044c\u044e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0441\u0431\u043e\u044f \u0432 \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435? \u041f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445<\/strong><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/827118\/\"> https:\/\/habr.com\/ru\/articles\/827118\/<\/a><br \/><\/br><\/br><\/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-425928","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/425928","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=425928"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/425928\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=425928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=425928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=425928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}