Response Received is incomplete

Posted by Aarem under .NET Framework on 4/4/2014 | Points: 10 | Views : 6448 | Status : [Member] | Replies : 5
I have developed SMS Application using the project given on the link:
http://www.codeproject.com/Articles/85636/Introduction-to-AT-commands-and-its-uses

While sending SMS, though the message is sent successfully, the function sendMsg is returning "False" and in error log its showing "Response received is incomplete" . What might be the problem since this returning value is important in my application.

Kindly check the timeout being sent in the Function [ExecCommand]in the following code:


public bool sendMsg(SerialPort port, string PhoneNo, string Message)

{ bool isSend = false;
try
{
string recievedData = ExecCommand(port, "AT", 300, "No phone connected");

recievedData = ExecCommand(port, "AT+CMGF=1", 1000, "Failed to set message format.");

String command = "AT+CMGS=\"" + PhoneNo + "\"";
recievedData = ExecCommand(port, command, 300, "Failed to accept phoneNo");

command = Message + char.ConvertFromUtf32(26) + "\r";

recievedData = ExecCommand(port, command, 5000, "Failed to send message");

if (recievedData.EndsWith("\r\nOK\r\n"))
{
isSend = true;
}
else if (recievedData.Contains("ERROR"))
{
isSend = false;
}
else //01 Apr 2014 (Added for the condition when isSend is returned as false even though the Message is sent)
{
isSend = true;
}
return isSend;
}
catch (Exception ex)
{
throw ex;
}

}
Thanks in advance. Any help will be appreciated.




Responses

Posted by: Vuyiswamb on: 4/15/2014 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
In my country this can never be done as you are doing , that is why i was reluctant to build my own service using the AT commands , but if i check what other people say is the following

http://forums.asp.net/t/1856629.aspx?Send+and+Read+SMS+through+a+GSM+Modem+using+AT+Commands+c+



Thank you for posting at Dotnetfunda
[Administrator]

Aarem, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Aarem on: 4/15/2014 [Member] Starter | Points: 25

Up
0
Down
Can u please clearly mention what is wrong in the code? I didnt get wat u mean by "In my country this can never be done as you are doing". If you give me some hint, it might help me out.

Aarem, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Aarem on: 6/3/2014 [Member] Starter | Points: 25

Up
0
Down
Hi expert, can u plz reply to the above email..

Aarem, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 6/4/2014 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Telecomunication companies are regulated per country. The Telecom Systems that are used are not the same due to infrastructure differences. e.g

In Lunux and Windows are both OS but when using these OS there are commands that you will find in Linux and there are commands that you will find only in Windows. that was just an example.

http://www.codeproject.com/Articles/85636/Introduction-to-AT-commands-and-its-uses




Thank you for posting at Dotnetfunda
[Administrator]

Aarem, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Loturn on: 3/16/2015 [Member] Starter | Points: 25

Up
0
Down
I agree with the previous commenters. Are you located in Nepal, right? Why don't you use an SMS gateway software (like this one: http://www.ozekisms.com) that enables to send messages seamlessly.

Aarem, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response