在C中使用共享内存实现的循环缓冲区 [英] circular buffer with shared memory implementation in c

查看:404
本文介绍了在C中使用共享内存实现的循环缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于什么原因,我已经尝试使用乒乓缓冲区概念.

我有一个UDP接收器,但在顺序
期间,我应该最多接收10 GB的文件
执行可能会丢失数据包(8K).....一个数据包为8K ....因为缺少10GB

250个数据包,每1 GB丢失50个数据包.


所以我尝试了乒乓球的概念和循环缓冲区,但我不会工作...任何人

与我分享想法....紧急

I am already tried with ping pong buffer concept for what reason is .

i have a one UDP receiver i should receive upto 10 gb files but during the sequential

execution it might lose the packet(8K).....one packet is 8K ....for 10gb is missing

250 packets and for 1 gb it missing 50 packets.


so i tried with the ping pong concept and circular buffer i wont work .....any one

have idea share with me....its urgent

推荐答案

1.如果使用的是UDP,则需要在数据报中包括一些额外的详细信息,以检查丢失的数据包并由服务器重新发送.
2.乒乓球概念"是什么意思?
3.对任何人来说都没有紧迫感.
1. If you are using UDP then you need to include some extra detail in your datagrams to check for lost packets, and have them resent by the server.
2. What do you mean by "ping pong concept"?
3. It is not urgent to anyone but you.


如果需要数据包可靠性,则不应该使用UDP,而应该使用TCP. UDP并不意味着具有高可靠性,如果要增加自己的开销使其变得可靠,则实际上是在将UDP转换为TCP.
If you need packet reliability, you shouldn''t be using UDP, you should be using TCP. UDP is not meant to have high reliability, if you''re going to add your own overhead to make it reliable, you''re essentially turning UDP into TCP.


1-使用TCP如果可以的话,请使用UDP代替
2-如果不能使用TCP,则应在数据包传输系统中实现确认和重新发送系统.

*-TCP具有比UDP更高的可靠性,并且比带有确认的UDP还要快
1- use TCP instead of UDP if you can
2- if you can not using TCP so you should implement an acknowledgement and resending system in your packet transfer system.

*- TCP is more reliable and also faster than UDP with acknowledgment


这篇关于在C中使用共享内存实现的循环缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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