Reputation: 4305
I want to know the amount of data arrived at my updclient including damaged/bad data, packet header etc. i want to calculate throughput using udp.
Thanks.
Upvotes: 0
Views: 344
Reputation: 70701
UdpClient
is a very high-level interface which doesn't provide access to raw packet data. To get such information, you will need to use some low-level API and process the packets yourself.
However, in practice, the chances of a packet getting damaged in transit are very low - most of the time, you either get the correct packet or you don't get the packet at all. The packet headers are generally of constant size (8 bytes for the UDP header and usually 20 bytes for the IP header), so you can just add this value to the size of each datagram (which is returned by UdpClient.Receive
) to get the total packet size.
Upvotes: 1