secured the socket connection