最近在开发一个上位机,在收尾测试阶段发生了一个头疼的问题:上位机在运行过程中总是时不时的意外断开!
报错的情况有:1、Error - RtlWerpReportException failed with status code :-1073741823. Will try ......
2 、Socket can not be enable or disnable by another thread ...
3、c pointer .....running time ...... 等等的错误
原因:在线程的run方法中直接调用了socket的read方法!
解决办法:在run方法中进行信号槽连接,将socket的readyread信号连接到线程的一个槽函数,然后在槽函数中调用socket的read方法!
注:在run方法中while循环要设置一个标志位,例如 int flag = 1;while(flag){connect(...); flag = 0;}
虽然只有三言两语,但是这个问题困惑了我将近半个月的时间...