adding back code to close socket on invalid connection
0x0 -> NULL