rmi vs servlets vs socket [英] rmi vs servlets vs sockets

查看:106
本文介绍了rmi vs servlets vs socket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

socket编程,rmi和Servlets有什么区别。何时使用什么?

what is the difference between socket programming, rmi and Servlets. When to use what?

推荐答案

Socket API是Java应用程序与之交互的低级(传输级)抽象。网络,以及远程客户端和服务的扩展。套接字和相关API支持可靠的字节流和不可靠的消息传递服务。它们通常用于TCP / IP和UDP / IP,但其他网络协议栈可以(至少在理论上)得到支持。

The Socket APIs are the low-level (transport level) abstraction by which a Java application interacts with the network, and by extension with remote clients and services. Socket and related APIs support reliable byte stream and unreliable messaging services. They are typically used for TCP/IP and UDP/IP, though other networking protocol stacks can (at least in theory) be supported.

RMI是一个框架和协议系列用于在Java应用程序之间实现应用程序级网络。它将网络交互建模为针对生活在其他应用程序中的对象的Java方法调用。此模型需要一种机制(通常是名称服务器),允许一个应用程序发布对象,以便另一个应用程序可以引用它们。这(以及RMI端口通常默认被阻止的事实)意味着在设置基于RMI的应用程序时需要进行大量的配置工作。

RMI is a framework and protocol family for implementing application-level networking between Java applications. It models network interactions as Java method calls made against objects that live in other applications. This model requires a mechanism (typically a name server) that allows one application to "publish" objects so that another application can refer to them. This (and the fact that RMI ports are typically blocked by default) means that there is a non-trivial amount of configuration effort in setting up RMI-based applications.

Servlets是主要的API集合,用于实现HTTP通信的服务器端;即用于在Java中构建Web服务器。它们(或者更确切地说是它们运行的​​Web容器)负责处理HTTP协议的细节,因此程序员(理论上)只需处理应用程序问题。

Servlets are a collection of APIs that are primarily designed for implementing the server side of HTTP communications; i.e. for building webservers in Java. They (or more accurately the web container in which they run) take care of the details of the HTTP protocol, so that the programmer (in theory) only needs to deal with "application" concerns.

实际上,servlet开发人员和/或部署人员必须处理其他事情,例如将URL映射到servlet到对象,安全性和身份验证。此外,Servlet只处理HTTP交互的服务器端......客户端必须由不同的API处理。 (您也可以认为Servlet本身做得不够,可以通过构建在Servlet之上的Web应用程序框架的扩散来证明。)

In practice, the servlet developer and/or deployer has to deal with other things such as mapping URLs to servlets to objects, security and authentication. In addition, Servlets only deal with the server side of an HTTP interaction ... the client side must be handled by different APIs. (You could also argue that Servlets by themselves do not do enough, as evidenced by the proliferation of web application frameworks that are built on top of Servlets.)

简而言之:


  • 套接字用于低级网络通信

  • RMI用于高级Java-to -Java分布式计算

  • Servlet用于实现网站和Web服务

这篇关于rmi vs servlets vs socket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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