对TCP数据包感到困惑 [英] Confused about TCP packets

查看:66
本文介绍了对TCP数据包感到困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序充当服务器并将文件中的字节发送到客户端应用程序。无论我在哪里尝试几乎所有机器,计算出的速度大约是每秒170k。在客户端机器上,数据包大小始终为1460,即使
我设置了SendBufferSize,将Buffersize设置为10000.我觉得无论带宽如何,我总是会被这个速度困住。我一直在测试网络机器和远程测试机器。我知道设置Buffersize
和发送,接收 大小与速度有很大关系,但是当我可以发送的最大值是1460时,这有什么关系呢?如果我做错了什么或者为了达到更高的速度我还需要做更多的工作,请告诉我。我想象
只能以每秒100-200kb的速度发送到网络PC。

解决方案

TCP是一种基于流的协议,你不应该这样做不关心数据包。  我认为你混淆发送/接收缓冲区大小(这是你与套接字库交换信息的方式)与某种关于TCP
协议的实现细节。


您如何确定 数据包大小始终为1460 ? (你的话)


你如何衡量你的速度,这似乎是你可能声称的:  每秒100-200kb


 


由于套接字接收而报告在接收缓冲区中接收的字节数调用与发送方的发送缓冲区大小无关。


单独的字节数并不能确定它们的传输速度,因此您还必须测量时间。


I have an application which acts as a server and send bytes from a file to client applications. No matter where I try on almost all machines the calculated speed is around 170k per second. On the client machines the packet size is always 1460, even though I have set my SendBufferSize, Recieve Buffersize to 10000. I feel as if I'm always going to be trapped with this speed regardless of Bandwidth. I have been testing out on Network machines and remotely distance ones. I understand that setting the Buffersize and the Send, receive size has a lot to do with the speed but what does that matter when the maximum I can send is 1460? Please Let me know if I'm Doing anything wrong or if there is more I need to do in order to reach higher speed. I cant imagine sending to a network PC at only 100-200kb per second.

解决方案

TCP is a stream-based protocol and you shouldn't be concerned with packets.  I think you're confusing send/receive buffer sizes (which is how you exchange information with your sockets library) with some kind of implementation details about the TCP protocol.

How are you determining that the packet size is always 1460? (your words)

How are you measuring your speed, which it seems like you may be claiming to be: 100-200kb per second?

 

The number of bytes that are reported to be received in the receive buffer as the result of your socket receive call have nothing to do with the sender's send buffer size.

The number of bytes alone does not determine the speed at which they are transmitted, for that you must also measure time.


这篇关于对TCP数据包感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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