Fix the issue that local monitor was closing the socket before listening on it again