This topic is now archived and is closed to further replies.


Tracking bandwidth use

Recommended Posts

I''m trying to find out the exact size of a UDP packet header to be able to track precisely how much bandwidth my network subsystem is using. I''m sorely lacking a reference book, but searching on the Internet has only turned up one page which reported the UDP packet header size as 28 (20 for IP, 8 for UDP header). Other than that, I''ve found a plethora of sites which ignore the IP component of the UDP packet header, reporting it to be just 8 bytes in size (clearly insufficient). Can someone please confirm the UDP packet header size? Is there an easier way of tracking bandwidth use than keeping a running total of the size of all the packets transmitted?

Share this post

Link to post
Share on other sites
My docs here say 20 bytes, or 23 bytes plus 1 byte padding.

Version: 4 bits
Header length: 4 bits
Service type: 8 bits
Total length: 16 bits
Identification: 16 bits
Flags: 3 bits
Fragment offset: 13 bits
Time To Live: 8 bits
Type: 8 bits
Header checksum: 16 bits
Source IP address: 32 bits
Destination IP address: 32 bits (total so far, 20 bytes)
IP options (optional): 24 bits
Padding (if IP options are used): 8 bits. ( new total, 24 bytes)

Please, if this is wrong, someone point out more authoritative documentation, as I''d like to correct my notes too.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files ]

Share this post

Link to post
Share on other sites
Kylotan, you are including only the IP header (which is as you pointed out, 20 bytes). IP header + UDP header is 28 bytes total (the original question).

Share this post

Link to post
Share on other sites