Keep track total data transferred

I am working on what could be described as something like
Rapidshare/MegaUpload/etc. I want to provided direct downloads to files
but also keep a record of how much data I’ve sent to one particular IP,
so that I can limit the amount of data per IP by X many megabytes. (I
realize this isn’t foolproof; the user employing proxies or whatever
circumvents this, but it’s still better to have it there and work for
most users even if some people have the know-how to beat it.)

I understand how to use send_file but how do I keep track of how much
data was actually sent? The dumb way to go about this would be to
assume that if a link was clicked and the file linked to was X many
megabytes, then that’s how much was downloaded, when realistically the
user could cut off the download at any given moment or never even really
save the file.

Is there any way for me to do this? Is it even feasible to do within
Rails iself?