I'm sending audio from the microphone in realtime from an iOS device to a server. The problem that I have:
When it gets disconnected for any reason, I don't know actually how many data has been read in the server. I would like this to be consistent. If the iOs device gets disconnected it keeps recording audio in a circular buffer until it reconnects and start sending audio again. The next bytes to send need to be exactly the follow bytes after the server stopped recording.
Does this make sense?
Thanks
There's no way for TCP itself to provide that information for you, because there will always be the possibility that packets were buffered for transmission somewhere along the way and never reached the destination.
The usual way to handle this would be to reconnect, then ask the server how many bytes it received, so that you can continue where you left off.