本文介绍了如何在GSMComm库中连接长短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
根据此页面 CreateConcatTextMessage
方法返回类型为SmsSubmitPdu[]
的数组,但是,当我尝试使用SendMessages
发送它时,却得到了MessageServiceError 500
.我想念什么?
According to this page the CreateConcatTextMessage
method returns an array with type SmsSubmitPdu[]
but, when I try to send it with SendMessages
I get a MessageServiceError 500
. What am I missing?
SmsSubmitPdu[] pdu2;
try{
pdu2 = SmartMessageFactory.CreateConcatTextMessage("My name is Barry Allen. And I am the fastest man alive. When I was a child I saw my mother killed by something impossible. My father went to prison for her murder.", "+639234597676");
comm.SendMessages(pdu2);
}
catch (MessageServiceErrorException e500){
MessageBox.Show(e500.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch (CommException e501){
MessageBox.Show(e501.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
推荐答案
您的代码应如下所示:
GsmCommMain comm=new GsmCommMain(/*Set your option here*/);
string txtMessage="your long message...";
string txtDestinationNumbers="your destination number";
//select unicode option by a checkBox or any other control
bool unicode = chkUnicode.Checked;
SmsSubmitPdu[] pdu = SmartMessageFactory.CreateConcatTextMessage(txtMessage, unicode, txtDestinationNumbers);
сomm.SendMessages(pdu);
这篇关于如何在GSMComm库中连接长短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!