<small id='q3AZm'></small><noframes id='q3AZm'>

      <bdo id='q3AZm'></bdo><ul id='q3AZm'></ul>

      <tfoot id='q3AZm'></tfoot>
    1. <legend id='q3AZm'><style id='q3AZm'><dir id='q3AZm'><q id='q3AZm'></q></dir></style></legend>

      <i id='q3AZm'><tr id='q3AZm'><dt id='q3AZm'><q id='q3AZm'><span id='q3AZm'><b id='q3AZm'><form id='q3AZm'><ins id='q3AZm'></ins><ul id='q3AZm'></ul><sub id='q3AZm'></sub></form><legend id='q3AZm'></legend><bdo id='q3AZm'><pre id='q3AZm'><center id='q3AZm'></center></pre></bdo></b><th id='q3AZm'></th></span></q></dt></tr></i><div id='q3AZm'><tfoot id='q3AZm'></tfoot><dl id='q3AZm'><fieldset id='q3AZm'></fieldset></dl></div>
    2. TCP 同时打开和自连接预防

      时间:2023-09-17

          1. <i id='ghuLO'><tr id='ghuLO'><dt id='ghuLO'><q id='ghuLO'><span id='ghuLO'><b id='ghuLO'><form id='ghuLO'><ins id='ghuLO'></ins><ul id='ghuLO'></ul><sub id='ghuLO'></sub></form><legend id='ghuLO'></legend><bdo id='ghuLO'><pre id='ghuLO'><center id='ghuLO'></center></pre></bdo></b><th id='ghuLO'></th></span></q></dt></tr></i><div id='ghuLO'><tfoot id='ghuLO'></tfoot><dl id='ghuLO'><fieldset id='ghuLO'></fieldset></dl></div>
              <bdo id='ghuLO'></bdo><ul id='ghuLO'></ul>
                  <tbody id='ghuLO'></tbody>
                <tfoot id='ghuLO'></tfoot>

                <small id='ghuLO'></small><noframes id='ghuLO'>

                <legend id='ghuLO'><style id='ghuLO'><dir id='ghuLO'><q id='ghuLO'></q></dir></style></legend>
              • 本文介绍了TCP 同时打开和自连接预防的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                TCP 标准具有同时打开"的特性.

                TCP standard has "simultaneous open" feature.

                该功能的含义,客户端尝试连接本地端口,当端口来自临时范围,偶尔可以连接到自身(参见这里).

                The implication of the feature, client trying to connect to local port, when the port is from ephemeral range, can occasionally connect to itself (see here).

                所以客户端认为它连接到服务器,而它实际上连接到自己.另一方面,服务器无法打开它的服务器端口,因为它被客户端占用/窃取了.

                So client think it's connected to server, while it actually connected to itself. From other side, server can not open its server port, since it's occupied/stolen by client.

                我使用的是 RHEL 5.3,我的客户端不断尝试连接到本地服务器.最终客户端连接到自身.

                I'm using RHEL 5.3 and my clients constantly tries to connect to local server. Eventually client connects to itself.

                我想阻止这种情况.我看到了该问题的两种可能解决方案:

                I want to prevent the situation. I see two possible solutions to the problem:

                1. 不要将临时端口用于服务器端口.同意临时端口范围并在您的机器上配置它(请参阅临时范围)
                2. 检查connect(),因为有人建议在这里.
                1. Don't use ephemeral ports for server ports. Agree ephemeral port range and configure it on your machines (see ephemeral range)
                2. Check connect() as somebody propose here.

                你怎么看?你是如何处理这个问题的?

                What do you thinks? How do you handle the issue?

                P.S.1

                除了我显然在寻找的解决方案,我希望您能分享一下您对这个问题的真实体验.

                Except of the solution, which I obviously looking for, I'd like you to share your real life experience with the problem.

                当我找到问题的原因时,我对我的工作场所不熟悉的人感到惊讶".通过定期连接轮询服务器是恕我直言的常见做法,所以这个问题是如何不为人所知的.

                When I found the cause of the problem, I was "astonished" on my work place people are not familiar with it. Polling server by connecting it periodically is IMHO common practice, so how it's that the problem is not commonly known.

                推荐答案

                对于服务器,你需要 bind() 套接字到端口.一旦 addr:port 对绑定了套接字,它将不再用于 connect() 中的隐式绑定.

                For server you need to bind() socket to port. Once addr:port pair had socket bound, it will no longer be used for implicit binding in connect().

                没问题,没问题.

                这篇关于TCP 同时打开和自连接预防的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:检测何时拔下网线 下一篇:使用 boost::asio 发送 Protobuf 消息

                相关文章

                最新文章

              • <tfoot id='0SEQP'></tfoot>

                  <bdo id='0SEQP'></bdo><ul id='0SEQP'></ul>

                    <legend id='0SEQP'><style id='0SEQP'><dir id='0SEQP'><q id='0SEQP'></q></dir></style></legend>

                    <small id='0SEQP'></small><noframes id='0SEQP'>

                    <i id='0SEQP'><tr id='0SEQP'><dt id='0SEQP'><q id='0SEQP'><span id='0SEQP'><b id='0SEQP'><form id='0SEQP'><ins id='0SEQP'></ins><ul id='0SEQP'></ul><sub id='0SEQP'></sub></form><legend id='0SEQP'></legend><bdo id='0SEQP'><pre id='0SEQP'><center id='0SEQP'></center></pre></bdo></b><th id='0SEQP'></th></span></q></dt></tr></i><div id='0SEQP'><tfoot id='0SEQP'></tfoot><dl id='0SEQP'><fieldset id='0SEQP'></fieldset></dl></div>