Server socket stays active even after .finish()...

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Server socket stays active even after .finish()...

Postby gymshoe » Sat Nov 01, 2008 5:57 am

Hi all,
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.)

Other details:
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!
Jim
gymshoe
Junior Developer
Junior Developer
 
Posts: 15
Joined: Wed Sep 10, 2008 6:07 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests