简体   繁体   English

使用Objective-C和Java的Google协议缓冲区

[英]Google Protocol Buffers with Objective-C and Java

I'm looking at setting up communication between an iPhone app and a Java based server and thought that google protocol buffers might be the way to go; 我正在寻找在iPhone应用程序和基于Java的服务器之间建立通信,并认为谷歌协议缓冲区可能是要走的路; however I've managed to get myself a bit confused and I'm not sure the best way to go about implementing this so I was hoping for a bit of friendly advice :) 但是我设法让自己有点困惑,我不确定实现这个的最好方法所以我希望得到一些友好的建议:)

Should I set up the Java server as a webservice and send the proto messages to it (via a post or something similar), or should I set up a client/server with the Java server accepting a connection and then the iPhone passing the proto message via the connection? 我应该将Java服务器设置为web服务并将proto消息发送给它(通过帖子或类似的东西),或者我应该设置客户端/服务器与Java服务器接受连接然后iPhone传递原型消息通过连接? I'm presuming the best way of doing it is to create an actual socket connection and pass messages back and forth that way; 我认为最好的方法是创建一个实际的套接字连接并以这种方式来回传递消息; but I could be wrong and setting it up as a webserver with messages/responses could be the best way. 但我可能是错的,并将其设置为具有消息/响应的网络服务器可能是最好的方式。

Any advice on the matter would be really appreciated. 对此事的任何建议都会非常感激。

Thanks, 谢谢,

Dan

I think it largely depends on how you plan to scale your application. 我认为这在很大程度上取决于您计划如何扩展您的应用程序。 A web server designed to run your servlet has scalability "baked in." 设计用于运行servlet的Web服务器具有“烘焙”功能。 If you just use a simple socket listener in a Java application, then where do you bring in the scalability? 如果您只是在Java应用程序中使用简单的套接字侦听器,那么您在哪里引入可伸缩性? There are ways to do it, but you probably would not need to worry about those issues as much if you just used Tomcat. 有办法做到这一点,但如果你只是使用Tomcat,你可能不需要担心这些问题。

The downside is that if you want to deploy something like Tomcat, there is a bit of a learning curve involved. 缺点是如果你想部署像Tomcat这样的东西,那么就会涉及到一些学习曲线。

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

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