Action after Login

I have used the command send(socket,“Action: Login\r\nUsername: mark\r\nSecret: mysecret\r\nActionID: 1\r\n\r\n”,strlen(“Action: login\r\nUsername: mark\r\nSecret: mysecret\r\nActionID: 1\r\n\r\n”)+1,0)) in C program to login to the Asterisk server.
Response: Success !
Message: Authentication accepted

Now i again run another command send(socket,“Action: Ping\r\nParameters: None\r\nActionID: 2\r\n\r\n”,strlen(“Action: Ping\r\nParameters: None\r\nActionID: 2\r\n\r\n”)+1,0)) , this time i get the result: Response: Error
Message: Missing action in request

Why? Can someone help me?

Thanks in advance,


After the authenitcation try sending a blank line. I can connect to the AMI via php but never used c. If you want my php code PM me.