问题描述
什么是两款Android应用的通用通信架构?
案例1:
我有两个Android应用程序,
a)一个是等待客户请求,处理请求(读取来自一些源码分贝数据),并将结果返回到客户端的服务器。此服务器应用程序在其自己独立的Android手机上运行。
b)第二个是,将请求发送到服务器应用程序在客户端(a)和它太运行在其自己独立的机器人电话
问题是,这两个应用程序都需要经过移动服务提供商,使沟通?或者他们可以直接通过一些公共IP / WIFI等什么是通信结构/架构这个应用程序?互相交谈
案例2:
我有运行在一个独立的android手机的Android应用程序,我希望它向一些服务器应用程序(Web服务器/应用服务器)在互联网上的一些机器某处运行,发送请求,并得到一些反馈。
再次做了两个应用程序都需要经过移动服务提供商,以方便沟通?或者他们只是通过一些公共IP建立直接的TCP / IP通讯?
任何参考条款将真正帮助。
感谢
迦特
如果你想使用3G,是的。如果你想使用无线网络,没有。一般情况下,Android应用程序不在乎Internet连接来的。
如果他们有一个WiFi连接,他们有一个WiFi连接。你做什么与WiFi连接是你的,使用Java插座,并尊重一切正常,问题的Internet接入(如NAT的)。
您问一个Java接口。你得到一个Java接口。你做一些与Java接口。如果这一Java的插座来源以及如何将其连接工作一般是在幕后:3G,WIFI,非常微小的旅鸽一中队等
What is the general communication architecture for two android applications?
Case 1:
I have two android applications,
a) One is a server that waits for client request, process the request( read data from some sqlite db) and return the results to the client. This server application runs on its own independent android phone.
b) The second is the client that sends the request to the server application in (a) and it too runs on its own independent android phone.
Question is, do the two applications have to go through the Mobile Service Provider to enable communication? or they can just talk to each other directly via some public IP/WIFi etc. What is the communication structure/architecture for this applications?
Case 2:
I have an android application running on an independent android phone, and i want it to talk to some server application (Web Server / Application Server) running in some machine somewhere on the internet, sends request and get some feed back.
Again, do the two applications have to go through the Mobile Service Provider to facilitate communication? or they just establish a straight TCP/IP communication via some public IP?
Any reference articles would really help.
Thanks
Gath
If you want to use 3G, yes. If you want to use WiFi, no. Generally, Android applications do not care where the Internet connection comes from.
If they have a WiFi connection, they have a WiFi connection. What you do with that WiFi connection is up to you, using Java sockets, and respecting all the normal problems with Internet access (e.g., NATs).
You ask for a Java socket. You get a Java socket. You do something with the Java socket. Where that Java socket comes from and how its connection works is generally under the covers: 3G, WiFi, a squadron of very tiny passenger pigeons, etc.
这篇关于如何两款Android应用程序互相交谈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!