I have a Java ServerSocket
on an android sharing app that shares files over the network via the HTTP protocol.
I want to tell the user who uses the ServerSocket
on his phone whether the other user using the browser clicked Abort or Pause.
At first I noticed that when client clicks pause it causes InputStream.read()
of the socket to throw IOException
with Broken pipe
message.
So I did this.
try {
// ...
} catch (IOException e) {
if( "Broken pipe".equals(e.getMessage()) ) {
progressManager.reportPaused();
} else {
progressManager.reportAbort();
}
Log.d(MY_LOGTAG, "SendFileResponse(). Exception: " + e.getMessage());
}
Testing the Abort button in browser it triggered progressManager.reportPaused();
And in logcat I noticed that it throw the same Broken pipe
exception.
I want a way to make a pause call progressManager.reportPause()
and an abort to call progressManager.reportAbort()
if possible.
if not possible I wonder if there is a way to tell the browser that we don’t support pausing and disable that pause button.