发送UDP数据包流

编程入门 行业动态 更新时间:2024-10-26 03:28:19
本文介绍了发送UDP数据包流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想编写一个通过UDP连接发送文件的应用程序。现在我对可靠传输不感兴趣,我只想获得最大吞吐量字节。我注意到,如果我只是创建一个循环来连续发送数据,那么只有少数数据包可以实现。所以我使用sleep()函数在发送时引入了延迟。所以现在我每10个数据包睡10毫秒,这似乎导致没有数据包丢失(通过本地主机传输)但是这个发送速度仍然接近它应该是的。 所以我想知道,是否有更多"适当"的调节UDP数据包发送的方法,以实现最大吞吐量? 感谢

Hi, I want to write an application that sends files over a UDP connection. Right now I am not interested in reliable transfer, I just want to get the maximum throughput of bytes. I notice that if i just create a loop to send data continuously only a few packets actually make it. So I introduced delay while sending, using the sleep() function. So now I sleep 10 ms every 10 packets and this seems to result in no packet loss (over a local host transfer)but still this sending speed is nowhere close to what it should be. So I wonder, is there a more "proper" way to regulate the sending of UDP packets such as to achieve maximum throughput? Thanks

推荐答案

如何定义吞吐量?如果你的意思是从主机发送数据包而不考虑它们是否在目的地收到,那么一个简单的循环,甚至是你有N个发送数量的异步应用程序,并且当前一个发送完成时启动另一个发送应该执行特技。 How do you define thruput? If you mean sending packets from the host without regards to whether they were received at the destination, then a simple loop, or even an asynchronous app where you have N number of Sends outudstanding, and start another send when the previous one completes should do the trick.

更多推荐

发送UDP数据包流

本文发布于:2023-08-07 10:39:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1318668.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据包   UDP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!