简体   繁体   English

Android网络

[英]Android networking

We are implementing a sever-client architecture and some of the client apps are supposed to run on android OS. 我们正在实现一个服务器 - 客户端架构,一些客户端应用程序应该在Android操作系统上运行。 The first idea that came to mind was to use java RMI, but the RMI api is obviously not implemented for android. 想到的第一个想法是使用java RMI,但显然没有为Android实现RMI api。

So 1) Is there a way to use the java RMI api in an android application? 那么1)有没有办法在Android应用程序中使用java RMI api? Can I just import it from the standard java library? 我可以从标准的Java库中导入它吗? 2) What are the possible substitutes for RMI which will work for both android and desktop applications? 2)什么是可用于Android和桌面应用程序的RMI替代品?

Thanks. 谢谢。

RMI is a bad solution for anything not stuck on the same subnet. 对于没有停留在同一子网上的任何东西,RMI是一个糟糕的解决方案 Its terrible at recovering from failures, and with roaming clients. 它很可能从故障中恢复,并与漫游客户一起恢复。

There are a ton of possible solutions, not limited to 有很多可能的解决方案,不仅限于此

  • HTTP REST style, with XML or JSON data HTTP REST样式,包含XML或JSON数据
  • JSONRPC/XMLRPC JSONRPC / XMLRPC
  • SOAP (not the best for a performance standpoint) SOAP(性能观点不是最好的)
  • Protocol Buffers over sockets (TLS/SSL, please). 套接字上的协议缓冲区(请使用TLS / SSL)。 Consider WebSockets. 考虑WebSockets。

If using a light weight JAVA/RMI Android implementation is feasible for your particular scenario you can take a look at the links below: 如果使用轻量级JAVA / RMI Android实现对于您的特定场景是可行的,您可以查看以下链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM