如何做到在android系统的Socket通信? [英] How to do Socket communication in android?
问题描述
我有一个任务,考虑某家机构模拟器,以及服务器,我必须从客户端emulator.I访问Web服务想这是不是在Android的可能,如果有人知道它请发送一些code段,以做到这一点。
I am having a task,considering one emulator as server and i have to access a web service from the client emulator.I think this is not possible in android,if anyone knows about it please send some code snippets to do this.
推荐答案
Android的的 java.net
包是pretty一样一样的Java的,所以你可以使用的 插座
和 的ServerSocket
S表示TCP通信或的 的DatagramSocket
为UDP。
Android's java.net
package is pretty much the same as Java's so you can use Socket
s and ServerSocket
s for TCP communication or a DatagramSocket
for UDP.
但是,目前的 SOAP Web服务的在Android SDK不支持,但你可以使用第三方库或建立你自己的。看看下面的问题:
However, there is currently no support for SOAP webservices in the android SDK but you can use third party libraries or build your own. Have a look at the following questions:
- How to call a net web service from android
- Regarding connecting to a webserver from android
这篇关于如何做到在android系统的Socket通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!