I am working on developing an application that requires me to establish multiple client-server based connections. Connection can be of two types where the Android device can be a server or a client. I can have up to 6 - 8 connections. Once the connections are set-up they need to be running in the background and are not typically affected by UI actions.
Since each connection can be blocking, I am wondering what is a good away to design t开发者_StackOverflow社区his app. Should I have two services for handling the server and client connections? Each service could have a "connection manager" that can spawn new threads when necessary. Or does creating two services even help? I presume spawning new processed would not be good as they will be expensive. Is this correct?
I would appreciate any suggestions. Also, if this use case is not typical please let me know if you need more information to make any recommendation.
Thanks, -Ray
I think you should implement a service with that manage a thread pool I made something similar if you want I can give you a hand... Luigi
精彩评论