串口超时设置里,将ReadIntervalTimeout设置为0与设置为MAXDWORD有什么区别?MSDN是这样写的:
A value of zero indicates that interval time-outs are not used. 
A value of MAXDWORD, combined with zero values for both the ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier members, specifies that the read operation is to return immediately with the characters that have already been received, even if no characters have been received. 我感觉好像没什么区别。。超时结构里的其他参数设置为0与MAXDWORD有区别吗?

解决方案 »

  1.   

    有,你注意这句...to return immediately with the characters that have already been received, even if no characters have been received. 
    读超时一个是读完立即返回,一个是超时返回,你可以实际试试,还有当把那些值调整之后你会发现读串口的数度会有不同,这就是超时的原因,超时主要用于读取连续,大量数据时接受的准确
      

  2.   

    情况一:我把ReadIntervalTimeout置为MAXDWORD,
    ReadTotalTimeoutMultiplier和ReadTotalTimeoutConstant均为0,情况二:我把ReadIntervalTimeout置为1,
    ReadTotalTimeoutMultiplier和ReadTotalTimeoutConstant置为1,两种情况下,串口接收同一大量数据,耗用时间完全一样,数据接收准确无误且连续。我又改变发送方串口的发送超时设置,接收同样数据耗用时间也是一样。
    这样看来,超时设置与读写串口的速度似乎没有直接联系。请教:zhangnanonnet(鱼欢) 
    “超时主要用于读取连续,大量数据时接受的准确”
    这句话如何理解。。我想知道,在什么情况下(如何设置超时结构里各参数的值),
    串口接收数据会不连续,串口接收数据会不准确?