码迷,mamicode.com
首页 > 其他好文 > 详细

Using fscanf to read message from FIFO will lost message

时间:2016-04-23 17:58:36      阅读:165      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!