Here's my oddity:
I have two emulators communicating via TCP - one a server and one aclient.
This all seems to work. Except, for....
when I force one emulator's server thread to exit its perpetual loop of
accepting inbound connections, that emulator finishes its server
thread, closes the sockets, and sets a flag which returns to the main activity which then
calls the .finish() method on the main activity. The main Activity
appears to end normally. (The screen returns to the "home" screen of
the emulator). However, this emulator continues to act as a server
for the other emulator, accepting inbound connections forever. The
only way to stop the connections is to close the server emulator. (It
doesn't stop the problem if I just click the "return" key or "home"
key on the emulator.)
Before calling finish(), I specifically close() the serverSocket and
other sockets I have been using.
I have not specifically called my threads as services (which I know
can run in the background). I have just executed the threads in my
main activity as standard java threads...
I really don't understand why this should be happening.
Thanks for any insight!