I want to include some built-in performance monitoring in my Winsock-based server program. I can easily keep track of the number of bytes that I send through Winsock functions, but I'm also interested in keeping track of how many bytes are sent out over the network. The difference is that the number of bytes sent out over the network will include the TCP/IP protocol header. This way I can see what sort of overhead I'm experiencing, which may be significant for my application.

Is there an easy way to get how many bytes have been sent over a socket, including all protocol headers or other overhead?