My question lies on the following assumptions which I hope are true, because I believe these as I read them while Googling my problems:
- Closing a Socket's OutputStream closes the socket too
- The flush() method of OutputStream does nothing
So I basically need to anyhow flush the data out of my OutputStream object for my app to work.
If you're interested in details then please see the following two links :
. Weird behavior : sending image from Android phone to Java server (code working)
This issue was resolved by closing the OutputStream. Doing that flushed all the data to the other end of the socket and made my app working further but this fix soon gave rise to problem number 2 - the corresponding socket also gets closed :
. SocketException - 'Socket is closed' even when isConnected() returns true