I'm working on a network service and would like to be able to recover from dropped connections by caching the output I was trying to send so I can resend it when the client reconnects to the service. My service is using NSOutputStream wrapping a socket connection to send output to the client.
Is there any way to get confirmation of what data was successfully sent to the client? TCP should know how much made it to the other end, but I don't know how to get that information out of the NSOutputStream.
Can anybody give me pointers as to how I can manage this? Thanks!
EDIT: Alternately, is there a way to determine if the socket connection is still valid before I send my data? I'm using USB for the connection media, so it should be a very reliable link as long as the software on either side maintains the connection. But I don't get a socket closed event until after I've already tried to send the data.