I connect to socket server in NodeJs using this command:
client = net.createConnection()
How can I then properly disconnect from the server?
I tried client.end()
and even client.destroy()
but when I check the connection status using netstat it shows that the connection is in state FIN_WAIT2.
How can I close and destroy the connection altogether?
net.createConnection()
returns a Socket object. client.destroy()
is what you want to do.
Source: http://nodejs.org/docs/latest/api/net.html#socket.destroy