Sorry if this is a silly question, I'm still a beginner in Android and couldn't find an answer to my question. I'm making an Android application that sends an input to a server and executes a Python script on that server to process the given input and generates an output. I was successful in sending data from Android client to Python server using SSH. 
I can also use SSH to retrieve the output back to the Android client. However, the Python script takes some time to generate the output, and I can't seem to find a way for the Android client to wait for the Python script to finish generating the output. I was able to do this on internet connection with using Firebase database and have the Python script upload the output into Firebase database and have the Android client listen for changes in database. But I'm looking for a way to do this locally without internet (i.e. Firebase).
So is there a way to make my Android application wait for a message from Python to know it has finished with generating the output so it can retrieve it back using SSH or any other way?
Was a protocol what was send a code what was suppost to say if that 2 files are the same. but i do not remember the name. For u will be more easy to send the storage information's in bits (to the device) and after to start that important transfer. when the device will lost the connection will need to compare the real storage memory with the first information's send it and if has not match to ask the user to reconnect to internet or something like that. Maybe is helping until some one will give u the answer.
How to make Android app wait for a message from Python on a local server without internet?