TCP Servers: Drop Connection, instead of resetting or responding?

感情迁移 提交于 2019-12-10 17:16:02

问题


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

  • The client never receives a response (200, 404 or otherwise)
  • The client is never notified that the connection is terminated (never receives connection reset or end of stream)
  • The server's resources are released (the server should not attempt to maintain the connection in any way)

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.

Why do I want this?

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.


回答1:


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

  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.

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.




回答2:


closing a connection should NOT send an RST. There is a 3 way tear down process.



来源:https://stackoverflow.com/questions/8127336/tcp-servers-drop-connection-instead-of-resetting-or-responding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!