使用GSM调制解调器不能发送超过160个字符的短信C# [英] Can't send more than 160 characters sms C# using GSM Modem

查看:61
本文介绍了使用GSM调制解调器不能发送超过160个字符的短信C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行了很多搜索,但仍找不到确切的信息.实际上,我正在开发一个winforms应用程序,该应用程序将允许用户在GSM调制解调器的帮助下使用GSMCOMM库发送批量短信.到目前为止,我所能实现的是我可以发送< = 160个字符的文本消息,但是当消息长度超过160个字符时,问题就开始了.我没有收到任何错误,似乎已经发送了短信,但实际上并非如此.我正在共享用于发送短信的代码段.请查看一下,让我知道问题出在哪里.谢谢.

I have searched a lot but still couldn't find exactly what am looking for. Actually i'm working on a winforms app that will allow user to send bulk sms using GSMCOMM library with the help of a GSM Modem. What i have achieved so far is that i can send text messages that are <= 160 characters but problem begins when a message gets longer that 160 characters. I don't get any error and sms seemed to have been sent but its not actually. I'm sharing my code snippet that is used to send sms. Please have a look at it and let me know where the problem is. Thanks.

SmsSubmitPdu[] pdus; 
comm.Open();
pdus = SmartMessageFactory.CreateConcatTextMessage(message, number);
comm.SendMessages(pdus);
comm.Close();

推荐答案

好了,因此,经过大量的努力,研究和对代码的微小更改,我得到了解决方案,并且现在可以正常使用了.我正在发布对我有用的解决方案,希望它也能帮助那些面临相同问题的人.

Alright, so after lots and lots of effort, research and minor change in the code i have got the solution and now it's working perfectly. I'm posting the solution that worked for me and I hope it will also help those who face the same problem.

请确保GSMCOMM库是最新的,即版本1.21.0,否则可能无法正常工作.

Please make sure that the GSMCOMM library is up-to-date i.e. version 1.21.0 otherwise it may not work properly.

这是正确的代码段.它会以短信形式发送短消息(即小于或等于160个字符)以及长文本消息(即大于160个字符).

This is the correct code snippet. It will send short messages (i.e. less or equal to 160 chars) as well as long text message (i.e. more than 160 chars) as a single sms.

OutgoingSmsPdu[] pdus = null;
comm.Open();
pdus = SmartMessageFactory.CreateConcatTextMessage(message, number);
comm.SendMessages(pdus);
comm.Close();

这篇关于使用GSM调制解调器不能发送超过160个字符的短信C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆