I use http based file upload in my c++ code (runs on linux/android). I use async tcp socket for writing file data. My issue is that my progress bar reflects what have been written to the socket, not what was actually sent out on the wire. Problem becomes obvious with slow links where it takes tens of seconds (sometimes over a minute) between 100% sent progress notification and send complete message.
I don't modify SO_SNDBUF, in my case it's 35KB (queried by getsockopt). How can I fix progress notification to correctly reflect current transfer status? Is there a way to query size of data that's still remains in the buffer? Is there a way to get TCP notification about transfer progress (as confirmed by remote socket)?