Android Question Android TCP connect to multiple servers async

Rusty

Well-Known Member
Licensed User
Longtime User
I have an Android app that needs to use TCP/Astreams/Prefix Mode to connect to a server (i.e. 192.168.1.1) and then communicate a bit then disconnect and then connect to another server (i.e. 192.168.1.2).

I am having some difficulty getting it to disconnect and also re-connect. Any suggestions are appreciated. I issue a stopservice and then a startservice to re-initialize everything. I think these two events occur too fast. Is there a way to detect service destroy?
My TCP code is a service.
Thanks,
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Erel. I have been successful by leaving the service running; closing Astreams; closing the socket; changing the IP address and letting the service re-open the new IP address. Works well...even repeatedly. :)
Once again, thanks for the guidance.
Rusty
 
Upvote 0
Top