擅长:python、mysql、java
<p>如果您试图打开到另一个主机的TCP连接,并看到错误“connection rejected”,这意味着</p>
<ol>
<li>您向另一台主机发送了一个TCP SYN数据包。</li>
<li>然后您收到了一个TCP RST数据包作为回复。</li>
</ol>
<p>RST是TCP数据包上的一个位,表示应该重置连接。通常,这意味着另一台主机已收到您的连接尝试,并且正在主动拒绝您的TCP连接,但有时,中间的防火墙可能会阻止您的TCP SYN数据包并将TCP RST发送回您。</p>
<p>见<a href="https://tools.ietf.org/html/rfc793" rel="noreferrer">https://tools.ietf.org/html/rfc793</a>第69页:</p>
<blockquote>
<p>SYN-RECEIVED STATE</p>
<pre><code> If the RST bit is set
If this connection was initiated with a passive OPEN (i.e.,
came from the LISTEN state), then return this connection to
LISTEN state and return. The user need not be informed. If
this connection was initiated with an active OPEN (i.e., came
from SYN-SENT state) then the connection was refused, signal
the user "connection refused". In either case, all segments
on the retransmission queue should be removed. And in the
active OPEN case, enter the CLOSED state and delete the TCB,
and return.
</code></pre>
</blockquote>