如何在连续接收数据时停止串行ComPort的通信 [英] How to stop Communication of Serial ComPort while receiving data continously

查看:104
本文介绍了如何在连续接收数据时停止串行ComPort的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从串行COM端口连续接收数据时,如果停止接收线程。


然后尝试关闭端口文件句柄以停止通信,但代码卡在closeHandle(fileHandle)方法中。


方法不会通过返回任何值而终止。由于这个应用程序没有完全接近它没有响应。


请帮我解决这个错误。请任何人告诉我如何安全关闭所有ComPort Connection并关闭读取文件的句柄。

解决方案

这是什么串口:一个真正的物理端口,一个虚拟机模拟端口(管道或其他),带有第三方驱动程序的USB设备(FTDI,Prolific等)?



While receiving data continuously from serial COM Port, if stopped receive thread.

Then tried to close the port file handle to stop communication but code get stuck at closeHandle(fileHandle) method.

Method does not terminated by returning any value. due to this application is not getting close completely it is not responding.

please help me to solve this error. please any one tell me how to close all ComPort Connection safely and close handle of  read file.

解决方案

What is this serial port: a real physical port, a virtual machine simulated port (pipe or whatever), USB device with a 3rd party driver (FTDI, Prolific etc.)?


这篇关于如何在连续接收数据时停止串行ComPort的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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