I am trying to send sms using at commands in c program. I am able to send the sms successfully sometimes. However during sometimes i will not be able to send the sms. In that case i am getting CMS ERROR as Buffer Overflow. This is random case.
Could anyone help regarding this issue. What does the buffer overflow indicate? How should we debug this issue? This is happening randomly. Sometimes while testing, in all cases the sms will be sent successfully. But sometimes we will get this error.
My code snippet is given below:
int fd_at;
char at_cmd[25];
char *number = "+91xxxxxxxxxx";
fd_at = open("/dev/ttyUSB2", O_RDWR | O_NOCTTY);
sprintf(at_cmd, "AT+CMGF=1\r");
ret = write(fd_at, at_cmd, strlen(at_cmd));
sprintf(at_cmd, "AT+CMGS=\"%s\"\r", number);
ret = write(fd_at, at_cmd, strlen(at_cmd));
ret = write(fd_at, "Hello\032", 6);
close(fd_at);
I have checked the return values of write in all cases. In all cases it is a showing the value needed. Is there any other thing needed for sending sms other than this.
Please help.
The error i am getting is given below.
+CMS ERROR: Buffer overflow
Thanks