我想编写一个通过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数据包流
发布评论