Check the flag api_sock not the unintialized varaible