I have a WinRT application that downloads using StreamSocketand DataWriter. It keeps track of load times and then calculates the bandwidth.
The problem I am facing is that I get throughput much higher than Wireshark shows. This is because my boot cycle ends and takes up the final timestamp before the WinRT environment actually sends data to the network layer. I did not find the means to get confirmation from the framework that the packages really went to the network level. The method DataWriter StoreAsyncreturns only the number of bytes you saved that I knew before I saved them.
Other frameworks, such as Windows Phone, have a callback that starts after sending your package and tells you how many bytes you downloaded. I did not find any equivalent in WinRT and had to settle for a loop that writes how many bytes I made in the function StoreAsync.
Is there a way to get confirmation from when and how many bytes really were sent to the network layer?
UPDATE: I gave @polkduran recommendations a try, and although they helped alleviate packet loss, I still experience significant packet loss with smaller file downloads (100 KB). For larger files (4 MB and 10 MB), all packets are sent, but the end time is still turned off by a couple of seconds, which significantly reduces the throughput calculation (compared to Wireshark routes). I assume that the callback simply slows down the download, and does not provide actual confirmation of the package being downloaded.
I am still looking for a solution to this problem.
EDIT: I created a support ticket with Microsoft on this issue. Their official answer is that there is no way in WinRT to confirm that the package has actually been downloaded.
source
share