开发者

TcpClient bandwidth estimation

开发者 https://www.devze.com 2023-01-31 09:03 出处:网络
I want to create bandwidth estimation tools using TcpClient. The problem im having is, I want to perform measurement in predefined time (instead of predefine buffer data length to transfer). If i use

I want to create bandwidth estimation tools using TcpClient. The problem im having is, I want to perform measurement in predefined time (instead of predefine buffer data length to transfer). If i use loops(transfer small chunks of data repeatedly), wouldnt that slow down the performance(manual fragmentation vs auto fra开发者_StackOverflowgmentation)?


It depends whether you disable the Nagle algorithm. If you do, then yes, you'll be fragmenting things yourself. If you don't, you're unlikely to achieve your aim - because the data may not actually be written when you think it is... unless the other end of the connection sends back a final "ack" of course.

I would suggest you use a smallish sample to work out the rough speed, and then create a larger sample based on that, predicting how long it will take. You'd need to measure the time anyway - it's not like you're going to hit an exact predefined time - so it shouldn't make too much difference. You can always adjust the size as you go to some extent anyway - I'd anticipate that you'd end up sending plenty of packets unless it's a really slow network, so if you decide half way through to only send 200K instead of 300K, that shouldn't make much difference.

That may sound like your original suggestion, of course - but I'm only talking about sending "pretty large" chunks of data per call... say 16K. (Much bigger than the packet size, anyway.) That shouldn't affect fragmentation much, but will still allow you to tweak things somewhat as you go. I wouldn't advise you to send tiny, tiny packets.

0

精彩评论

暂无评论...
验证码 换一张
取 消