错误-无法打开端口... [英] Error - Unable to open port...
问题描述
你好,
我正在使用GsmComm.GsmCommunication库,并且在发送消息时遇到问题.
我一次循环发送多个消息.我的数据库中大约有150条消息要发送.当我发送消息时,有时会发送25条消息,有时会发送30条消息,然后显示错误无法打开端口",这意味着它一次不会发送所有消息.当我再次运行应用程序时,它发送20或30条消息,然后出现相同的错误.
我正在使用诺基亚e50设备.
有人可以告诉我解决方案吗?
在此先感谢.
关于
Hello,
I am using GsmComm.GsmCommunication library and I have a problem while sending messages.
I am sending more than one message at a time in a loop. There are about 150 messages to send in my database. When I am sending the messages, sometimes it sends 25 and sometimes 30 messages, then it shows the error "unable to open port" meaning it doesn''t send all messages at a time. When I run my application again, it sends 20 or 30 messages then I get the same error.
I am using a Nokia e50 device.
Can anyone please tell me the solution?
Thanks in Advance.
Regards
推荐答案
我想端口正变得太忙,无法发送/接收任何数据.
我建议您在发送一些消息(例如10或15)后等待几秒钟.因此,请执行以下操作:
I guess the port is becoming too busy to send/receive any data.
I would suggest you to wait for few seconds after sending some messages (say 10 or 15). So do something like this:
for (int i = 0; i < messageCount; i++)
{
if (i % 15 == 0)
{
System.Threading.Thread.Sleep(10000);
}
//code for sending message
}
在每15条消息之后,我将停止处理10秒钟.
我希望你有主意.试试这个,让我知道是否有帮助. :thumbsup:
Here after every 15 messages I am stopping the processing for 10 seconds.
I hope you got the idea. Try this and let me know if it helps. :thumbsup:
这篇关于错误-无法打开端口...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!