How to use Asterisk AMI?

I have used the command “sendto(clifd, bufLogin, BUFFER_SIZE, 0, (struct sockaddr_in *)&servaddr, socklen))” in C program and the “bufLogin” in the command is :“Action: login\r\nUsername: admin\r\nSecret: admin\r\n\r\n” , and the debug message(it is “Response: Success
Message: Authentication accepted”) of the remote asterisk server shows that i have logined on successfully. Now i again run another command “sendto(clifd, bufPing, strlen(bufPing), 0, (struct sockaddr_in *)&servaddr, socklen))” and the bufPing in the command is “Action: Ping\r\nParameters: None\r\n\r\n” , this time i get the result :Response: Error
Message: Missing action in request" ,and my /var/log/asterisk/full contains the following messages:"Oct 30 03:21:43 DEBUG[2627] manager.c: Manager received command ‘’ ",shows that the ping command is NULL ? Why? Can someone help me?

thanks in advance… xutom