MSComm控件问题

cs3005 2005-08-19 02:27:19
我使用MSComm控件,接收一个,长度为67个字节的串,
要两次才能收全,有时一次。
不知道为什么两次才能收全,经常是,收了8个字节就近中断。
请问如何解决。

...全文
149 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cs3005 2005-08-20
  • 打赏
  • 举报
回复
帮我一下吧


cs3005 2005-08-20
  • 打赏
  • 举报
回复
帮帮我吧


hustxifangshibai 2005-08-20
  • 打赏
  • 举报
回复
不知道你写的接收的程序怎么写的,偶写的一个接收还行,贴出来看看:
private void axMSComm1_OnComm(object sender, System.EventArgs e)
{
if(!stop)
{
Thread b=new Thread(new ThreadStart(ProcessCom));
b.IsBackground=true;
b.Start();
}


}
private void ProcessCom()
{
if (axMSComm1.InBufferCount > 0) ProcessComData((string) axMSComm1.Input);
}
private void ProcessComData(string input)
{
// Send incoming data to a Rich Text Box
Txtbox_Recev.AppendText(input);
}
xiaopai20 2005-08-19
  • 打赏
  • 举报
回复
gz

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧