Java Sockets and Dropped Connections
What's the most appropriate way to detect if a socket has been dropped or not? Or whether a packet did actually get sent? I have a library for sending Apple Push Notifications to iPhones through the Apple gatways ( available on GitHub ). Clients need to open a socket and send a binary representation of each message; but unfortunately Apple doesn't return any acknowledgement whatsoever. The connection can be reused to send multiple messages as well. I'm using the simple Java Socket connections. The relevant code is: Socket socket = socket(); // returns an reused open socket, or a new one socket