Java:套接字或RMI? [英] Java: Sockets or RMI?

查看:143
本文介绍了Java:套接字或RMI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将我们的应用程序分成一个轻量级的gui应用程序和一个业务逻辑应用程序。这不会是一个客户端/服务器设置,因为'服务器'组件只有一个客户端。

I need to separate our application into a light-weight gui application and a business logic application. This won't be a client/server setup as such, as the 'server' component will only have one client.

应用程序的另一个限制是只有一个入口/出口点。因此,如果我们使用RMI,它将只有一个函数。所有表单数据已经封装成一个字符串,并通过一个传输区域。

The other limitation in the application is that it has only one entry/exit point. Therefore if we were to use RMI, it would only ever be on one function. All form data is already wrapped up into a string and passed through one transport area.

我应该使用Java套接字来增强这个应用程序,还是和RMI一起使用?还是一些其他的Java技术?

Should I just use Java Sockets to enhance this application, or go with RMI? Or some other Java technology?

我在前一篇文章概述了我们的应用程序的要求,但它没有回答。 http://stackoverflow.com/questions/2604528/ terminal-panel-pc-single-server-solution-client-server-or-rdp

I made a previous post outlining the requirements of our application, however it went unanswered. http://stackoverflow.com/questions/2604528/terminal-panel-pc-single-server-solution-client-server-or-rdp

干杯。

推荐答案

就个人而言,如果你只有一个方法调用,RMI似乎有些过分,所有的数据已经包裹在一个字符串。我想象一个简单的套接字服务器将足够满足您的需要。然而,RMI确实免费给你一些东西,比如多线程,分布式垃圾收集,对象编组等等。然而,如果你只有1个客户端,那么多线程可能没有用,因为你正在做自己的对象编组,然后这些好处可能不会给你带来什么。

personally, RMI seems like a bit of overkill if you've just got one method to call, and all your data is already wrapped in a string. i imagine a simple socket server would suffice very well for your needs. however, RMI does give you a bunch of stuff for free, like multithreading, distributed garbage collection, object marshalling, etc etc. however if you only have 1 client then multithreading might not be useful and since you're doing your own object marshalling then these benefits might not gain you anything.

这里有一个很好的页面rmi的能力: http://java.sun.com/javase/technologies/core/basic/rmi/whitepaper/index.jsp

there's a good page on rmi's capabilities here : http://java.sun.com/javase/technologies/core/basic/rmi/whitepaper/index.jsp

这篇关于Java:套接字或RMI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆