TCP服务器:丢弃连接,而不是重置或响应? [英] TCP Servers: Drop Connection, instead of resetting or responding?

查看:190
本文介绍了TCP服务器:丢弃连接,而不是重置或响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Node.JS是否有可能以这样的方式删除连接

Is it possible in Node.JS to "drop" a connection in such a way that


  • 客户端永远不会收到响应( 200,404或其他方式)

  • 永远不会通知客户端连接已终止(从未接收连接重置或流结束)

  • 服务器的资源被释放(服务器不应该尝试以任何方式维护连接)

我特别询问Node.JS HTTP服务器(在Solaris上,它实际上只是复杂的TCP服务器),但如果有其他操作系统(Windows,Linux)或编程语言(C / C ++,Java)允许这种情况,我很感兴趣。

I am specifically asking about Node.JS HTTP Servers (which are really just complex TCP servers) on Solaris., but if there are cases on other OSes (Windows, Linux) or programming languages (C/C++, Java) that permit this, I am interested.

我为什么要这样?

惹恼或放慢(可能是单线程)机器人,例如 phpMyAdmin探测

To annoy or slow down (possibly single-threaded) robots such as phpMyAdmin Probe.

我知道这不重要,但这些类型的问题可以更好地帮助我了解我的课程的界限。

I know this is not really something that matters, but these types of questions can better help me learn the boundaries of my programs.

我知道客户端主机可能会重新传输连接数据包,因为我从不发送重置。

I am aware that the client host is likely to re-transmit the packets of the connection since I am never sending reset.

推荐答案

这些在通用TCP堆栈中是不可能的(与您自己的自定义TCP堆栈相比)。原因是:

These are not possible in a generic TCP stack (vs. your own custom TCP stack). The reasons are:


  1. 关闭套接字发送RST

  2. 即使您避免发送RST ,当服务器关闭连接时,客户端继续认为连接已打开。如果客户端在此连接上发送任何数据包,则服务器将发送RST。

  1. Closing a socket sends a RST
  2. Even if you avoid sending a RST, the client continues to think the connection is open while the server has closed the connection. If the client sends any packet on this connection, the server is going to send a RST.

您可能想要探索这些机器人的防火墙,并使用像iptables(linux)或solaris上的等价物来阻止/限制他们的IP地址。

You may want to explore firewalling these robots and block / rate limit their IP addresses with something like iptables (linux) or the equivalent on solaris.

这篇关于TCP服务器:丢弃连接,而不是重置或响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆