I have a node.js TCP server, set up in the following fashion:
var net = require('net');
...
var gatewayTcpServer = net.createServer(gatewayServer.onGatewayClientConnection);
In order to minimise the chances of hacking / DDOS attacks, I would like to kill a connection if it receives odd data, or remains open without communicating for too long.
Is it possible to disconnect / reject the connection, using the socket that is passed to the onGatewayClientConnection
delegate?
Further digging through the documentation reveals socket.destroy() is a thing
Ensures that no more I/O activity happens on this socket. Only necessary in case of errors (parse error or so).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.