首页 > 其他 > 详细

Using fscanf to read message from FIFO will lost message

时间:2016-04-23 17:55:52      阅读:267      评论:0      收藏:0      [点我收藏+]

In libcurl example hiperfifo.c, function fifo_cb uses fscanf(fifo inputstream,...) to read in a string.
rv=fscanf(g->input, "%1023s%n", s, &n);
When the fifo content producer sends two urls continuously with no interval, the fifo_cb will lost the second url.
But if the fifo content producer sends the second url 3ms later, the fifo_cb will not lost it.
With using read (fd,...) instead of fscanf,
read_res = read(fd, &dwMsgPtr, sizeof(dwMsgPtr));
the fifo_cb will not lost the second url even if the fifo content producer sends two urls continuously with no interval.

Using fscanf to read message from FIFO will lost message

原文:http://www.cnblogs.com/flyfish163/p/5424997.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!