开发者

android service to listen to a specific port

I want to know how to set an android service that listen to a specific port e.g. htt开发者_如何转开发p://127.0.0.1:12345


Implement your service and use the ServerSocket class to listen for incoming connections and to act on them. Don't call ServerSocket.accept() on your UI thread, though. That'll cause your application to not respond. Instead, create a new thread or depending on your actual scenario, an AsyncTask might be sufficient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜