RO38 –比较RemObjects SDK 通道

本文概述了RemObjects SDK 提供的各种通信通道,包括HTTP、SuperTCP、SuperHTTP等,详细介绍了每种通道的特点、应用场景及客户端和服务端组件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
RO38 –比较RemObjects SDK 通道                                  
本文汇总了RemObjects SDK提供的通道:
  • 最通用的通道
    • 1) HTTP 通道:使用www超文本传输协议的灵活,网络无关的通信.
    • 2) Super TCP 通道: 在客户端服务端灵活通用的双向传输.
    • 3) Super HTTP 通道- new in 'Vinci'
  • 常用的通道Frequently used channels
    • 4) 以前的TCP通道: 通过TCP实现轻量级通信.
    • 5) Email 通道(Delphi): 与存在的Email组织异步通讯.
    • 6) Local 通道:直接应用程序内部通信.
    • 7) DLL 通道(Delphi): DLL中执行服务端逻辑,并通过标准的RemObjects SDK接口调用机制调用.
  • 很少使用的通道
    • 8) UDP and Broadcast 通道(Delphi): 轻量数据包通信.
    • 9) Named Pipe 通道:不使用TCP/IP的局域网内部的通信.
    • 10) WinMessage 通信(Delphi): 本机中的内部过程通信.
 
1) HTTP 通道
最常用的通道可能是基于超文本传输协议的. HTTP 协议, 组成www的基础,Internet中最常用的协议之一,RemObjects SDK中使用可以提供各种好处:
  • 由于HTTP的广泛使用,这种协议可以在轻松用于受限的网络环境,如有防火墙或使用代理将客户端与Internet隔离. 如果终端用户可以通过浏览器访问网络,基于HTTP通道的客户端也非常可能运行.
  • 服务端地址使用标准的URL标识,这样用户可以轻松明确的处理地址.
  • 如果希望,HTTP通道可以提供人们能直接读取的服务端信息和开放的服务信息,并可以通过web浏览器查看.
总之,HTTP是当你位于扩展站点而无法控制网络时最好的协议,可以使你的客户端轻松的在各种类型的网络中工作.
两种版本(Delphi .NET)中都提供了HTTP客户端和服务端通道的几种实现,至于那种最好这取决于用户的偏爱和体会.所有的HTTP客户端都可以连接到HTTP服务端,反之亦然.
值得一说的是基于WinINET的客户端通道(Delphi .NET)可以使用IE浏览器的设置,包括使用代理和自动拨号规则,然而IndyInternet数据包通道将使用实现于原始TCP之上的HTTP.
对于Delphi,BPDX服务通道提供了最好的性能和灵活性,但是这比轻量的Indy服务通道需要更多的资源.
客户端通道组件:
  • IpHttpClientChannel (.NET)
  • WinInetHttpClientChannel (.NET)
  • TROIndyHttpChannel (Delphi)
  • TROWinInetHTTPChannel (Delphi)
  • TROSynapseHTTPChannel (Delphi)
服务端通道组件:
  • IpHttpServerChannel (.NET)
  • HttpSysServerChannel (.NET)- new in 'Vinci' (see note)
  • WebProcessor (ASP.NET)
  • TROIndyHTTPServer (Delphi)
  • TROBPDXHttpServer (Delphi)
  • TROWebBrokerServer (Delphi)
 
注意:
HttpSysServerChannel
使用从IIS共享的微软HTTP内核,这样允许standalone服务从IIS web服务中分派一个端口.
2) Super TCP 通道
Super TCP通道组件提供实用灵活的通信通道,使用永久连接实现真正的异步通讯和服务回调.
在原始的TCP连接之上改进的客户自定义协议,这个通道允许使用传统通道类型所没有的高级特性:
  • 保持实时连接,通过灵活的PING/PONG系统发现断开的连接(如由于网络繁忙)并无缝修复.
  • 结合服务端和客户端通信,可以使服务端向客户端主动的发送事件或异步响应,而不用去轮询,减少了网络流量提高了回调的效率.
  • 允许使用单通道同时发送多个请求.
这个通道广泛的用于需要事件和服务回调的情形,而且有防火墙和代理服务时也不要求使用基于HTTP的通道.
客户端通道组件:
  • SuperTcpClientChannel (.NET)
  • TROSuperTcpChannel (Delphi)
服务端通道组件:
  • SuperTcpServerChannel (.NET)
  • TROSuperTcpServer (Delphi)
 
3) Super HTTP 通道- new in 'Vinci'
这个通道如Super TCP通道一样提供了双向通信,但是它基于HTTP,从而可以穿透防火墙和精确的代理. 它比Super TCP通道的代价稍高一些,因为要在服务端使用两条连接.
客户端通道组件:
  • IpSuperHttpClientChannel (.NET)
  • WinInetSuperHttpClientChannel (.NET)
  • TROIndySuperHttpChannel (Delphi)
  • TROSynapseSuperHttpChannel (Delphi)
服务端通道组件:
  • IpSuperHttpServerChannel (.NET)
  • HttpSysSuperHttpServerChannel (.NET)
  • SuperHttpWebProcessor (ASP.NET)
  • TROIpSuperHttpServer (Delphi)
 
4) 过期的 TCP 通道
TCP,一种传输控制协议,是两种基于底层的使用TCP/IP网络堆栈的Internet通讯基本协议之一,在客户端和服务端通过连接提供数据传输.然而TCP也为更复杂的传输协议(HTTP,POP3)提供支持,TCP通道使用原始的TCP提供轻量协议,在传输消息中没有添加任何附加信息.
当网络流量小并且没有使用防火墙时TCP通道是最好的选择.这时TCP通道可以提供方法调用的最好执行效率.
Delphi,BPDX服务通道提供了最好的效率和高灵活行,但是要比轻量Indy服务通道需要更多的资源.
客户端通道组件:
  • IpTcpClientChannel (.NET)
  • TROIndyTcpChannel (Delphi)
服务端通道组件:
  • IpTcpServerChannel (.NET)
  • TROIndyTcpServer (Delphi)
  • TROBPDXTcpServer (Delphi)
 
5) Email 通道 (Delphi)
Email通道使用标准的Email和存在的POP3SMTP服务执行异步通讯,向服务端发送请求并接收响应.
客户端通道指定Email地址,并使用这个地址向服务端发送处理请求.服务端从POP3信箱中接收到邮件,处理请求,最后也使用Email的形式向客户端返回处理结果. 客户端通道通过轮询其POP3信箱接收响应.
这个通道适用于长时间执行(可能会超过单个客户端Session的有效时间OutTime)的请求. 由于请求和响应在POP3信箱中是持续的,客户端发送请求后退出,而接收响应可能要在几小时或几天以后.同样,请求发送到服务端可能不会马上执行-服务端启动后将从其邮件箱中提取并处理邮件.
客户端通道组件:
  • TROEmailChannel (Delphi)
服务端通道组件:
  • TROEmailServer (Delphi)
 
6) Local 通道
Local通道允许RemObjects SDK.NETDelphi应用程序中基于单机通讯; 使你可以轻松重用集成的客户端和服务端应用程序,或建立单层应用程序稍后可以简单的修改通道类型移为他用.
关于第一方面将应用程序逻辑分为客户端和服务器然后又要在同一个执行文件中使用看起来可能没什么用处,这个通道在如下两种情形时很有帮助, 特别是当结合Data Abstract数据库多层架构:
  • 在保留扩充性的前提下实现一个单层应用程序,在需要的时候可以很容易的升级为三层解决方案.
  • 将多层应用重用与单层环境-如出售单用户版本的产品,提供一个桌面版的客户机/服务器数据库前端.
在这两个案例或相似的情况下,Local通道可以简单的将客户端和服务端组合在一个应用程序中,但是仍然保留了逻辑上的多层次分离.
客户端通道组件:
  • LocalClientChannel (.NET)
  • TROLocalChannel (Delphi)
服务端通道组件:
  • LocalServerChannel (.NET)
  • TROLocalServer (Delphi)
 
7) DLL 通道 (Delphi)
DLL通道允许你在DLL内部执行服务逻辑,其使用标准的RemObjects SDK 调用机制. 通道自动为你的客户端过程加载DLL,并像远程服务一样将服务端方法开放出来.
为什么要使用这个通道请查看上面的Local通道小节.
客户端通道组件:
  • TRODLLChannel (Delphi)
服务端通道组件:
  • TROLocalServer (Delphi)
 
8) UDP Broadcast 通道 (Delphi)
除了TCP, UDP是另外一个Internet TCP/IP网络组织的基本传输协议.TCP相比,UDP没有基于连接传输数据的概念,而是在网络中发送单独的数据包-可寻址数据包.
UDP也提供了没有错误修正和保证的传递方式,所以通过UDP发送的数据包可能会并没有达到目的地而丢失,或发生错误而简单的放弃.同时UPD通过自动截取而不提供大数据包的传递.总之,UDPTCP相比更快更有效率.
你可能想在需要高频率高效率传递小数据包事使用基于UDP的通道,而且不用去考虑网络错误调整和包恢复(TCP提供的特性).这只能用于局域网的情形,网络组织可靠并且发生丢包的情况非常少.
Broadcast通道与UDP通道变化而来,允许你向本地网络中所有可用的服务端使用UDP广播发送请求. 这在通知或搜索可用服务端时非常有用.
这两种通道可以用于异步模式;对于广播的情形,你的服务端将调用ROSendNoResponse 防止任何响应形式发送(以便于大量的接收方可以取消消息通知),直到你的客户端将准备好接收多个响应.
客户端通道组件:
  • TROIndyUdpChannel (Delphi)
  • TROBroadcastChannel (Delphi)
服务端通道组件:
  • TROIndyUdpServer (Delphi)
  • TROBroadcastServer (Delphi)
9) Named Pipe 通道
这个通道使用Windows的命名管道特性在客户端和服务端通讯.推荐使用命名管道在单机的不同进程直接通讯,尤其是在不同用户环境下运行.这很有用,例如对服务的控制.
请订阅平台SDKMSDN文档查看更多命名管道信息.
提示: 牢记一个要点: Windows设置了同时连接到一个命名管道的客户端数量-Home版为5,Pro版为10. 如果要运行一个网络服务TCP/IP是最好的选择.
客户端通道组件:
  • NamedPipeClientChannel (.NET) - new in 'Vinci'
  • TRONamedPipeChannel (Delphi)
服务端通道组件:
  • NamedPipeServerChannel (.NET) - new in 'Vinci'
  • TRONamedPipeServer (Delphi)
 
10) WinMessage 通道 (Delphi)
这个通道使用Windows消息在客户端和服务端通讯.
这是在单机内部进程间通讯的一个简单方式,Windows消息有一些限制-不能在Windows服务(Exe文件对应)中与服务(Service)通讯, 使用Windows消息(MSMQ)轮询来实现客户端和服务端通讯. 请订阅平台SDKMSDN文档查看这个概念的更多信息.
客户端通道组件:
  • TROWinMessageChannel (Delphi)
服务端通道组件:
  • TROWinMessageServer (Delphi)
 
结论
本文比较了各种通道然后使用他们,如果你在使用时有什么问题请发送Email support@remobjects.com联系.
 
一、 简介 1、 RemObjects SDK 综述 欢迎使用RemObjects SDK,这个框架可用简单灵活的方式创建可升级高灵活性的多层系统。 多层系统 一个多层系统分为两层或两层以上。通常人们分为3层: 表示层:终端用户程序,Web页面或可执行文件 业务逻辑/中间层:这个层的对象(运行于一些不可见的容器中)执行确认和业务逻辑。 数据存储层:通常是数据库。 基于这个基础结构上还有很多其他形式的框架,并且都在我们文档讨论的范围之外.但是你必须知道很重要的一点,创建任何分布式系统都需要一种消息协议让客户端和中间层通讯. 标准的消息协议是RPC-protocol (DCOM的基础), Java的 RMI 或 SOAP. RemObjects SDK适合作什么 为什么当一些协议都是适用的我们还要”重复制造车轮”?这有以下几个原因: 对于DCom,如果你所有的机器都运行Windows系统并且你会配置安全,他可以在局域网中运行的很好.但COM/DCOM对Windows和Unix的通讯不适用.事实上他是Windows上的标准.而且你要在你的机器上使用基于HTTP的COM对象就必须为RPC-通讯打开防火墙的几个端口. 对于RMI,RMI是针对Java的. Borland从来没有提供和RMI通讯的工具.就算有这种工具,你还是不能和COM对象通讯. 而SOAP呢?它是唯一的公认标准消息. 看起来他实现了互用性,但是却建立在解析XML高代价之上. 除非你有高速网络或只需要发送很小的包,否则你很难使用它. 这样的例子还很很多. RemObjects的目标 RemObjects为实现下面的目标而设计: 简单:开发者不需要是专家,不需要很长的时间就可以为网络中的电脑或Internet的客户端中发布自己的简单服务.Delphi开发者不用面对自己不熟悉的语法.并且你可以轻松的理解他的原理. 高效:我们通常在本机的两个进程通讯时使用Socket,使用标准协议像Soap做客户端和服务器的通讯,为什么没有一种通用的方式可以发布我们的服务呢?RemObjects SDK允许我们创建高效的服务,并可以使用我们需要的协议方式通讯. 灵活:RemObjects SDK使用TCP/IP,HTTP,和Windows消息作为传输信道.而我们要使用UDP或管道时我们就可以轻松的创建新的信道,只要通知服务器和客户端即可,不用修改其他部分.RemObjects SDK的插入式框架可以让我们写一个简单的函数或实现一个接口IROTransportChannel即可建立新的通讯信道而扩展基础框架.
Sample Categories Some samples are shown below in more than one category. The Dynamic Request, RODL and Named Pipe samples do not ship with the trial version of the RemObjects SDK. Category Samples Introduction First Sample Multi Channel Super TCP Channel Chat RODL (not shipped with the trial version) Async Auto Server Dynamic Request (not shipped with the trial version) Session Types Time Server Channels MegaDemo Multi Channel Super TCP Channel Chat HTTP Chat Named Pipes (not shipped with the trial version) Intermediate Arrays Broadcast Chat Extended File Transfer Named Pipes (not shipped with the trial version) Service Discovery Variants Architecture Session Types Class Factories FPC Server DataSnap Dispatch Notifier Auto Server Multi Channel Proxy Server Advanced Class Factories COM Dispatch Notifier Proxy Server Sample Descriptions Name Category Description Arrays Intermediate This sample shows how to use TROArray for presentating DB tables in a master/detail relationship. Async Introduction This sample shows how to call methods on a RemObjects SDK server asynchronously. There may be times where you want to submit a request for information and defer receiving the result until a bit later. A very simple calculation (Sum) is performed, but this has a built in ten second delay so that it is possible to query the server before the calculation is completed. Auto Server Introduction Architecture This sample shows how a client can control its server when they are both running locally. This is useful if you want to provide a simple standard alone solution which is easily upgraded to multi-tier (or you might want to provide both options). Broadcast Chat Intermediate This example shows how to use the TROBroadcastServer and TROBroadcastChannel channels to write an UDP broadcasting chat program. Class Factories Architecture Advanced This example shows how to use a Class Factory to generate three types of server: Singleton: all clients access a single server object. Single Call: server instances are created on demand and destroyed after processing the method call. Pooled: multiple server instances are accessible by clients. This works exactly the same as Singleton, unless the first server instance is busy. Note: to test this sample properly, you need to run at least two clients. COM Advanced This sample shows how to call an existing RemObjects SDK server using COM. DataSnap Architecture Standard example of the use of the TRODataSnapModule and TRODataSnapConnection components. Dispatch Notifier Architecture Advanced This example shows how to customize message dispatching. IRODispatchNotifier is a special interface that TROInvoker classes know and look for. If your server side object implements it, the IRODispatchNotifier.GetDispatchInfo method will be called before the target method is invoked. Dynamic Request (not shipped with the trial version) Introduction This example shows how to use the TRODynamicRequest component to execute server methods. Extended File Transfer Intermediate This example shows how to transfer files to and from a RemObjects SDK Server in chunks and how to monitor new files via server events. Note: needs at least two clients open. File(s) uploaded from one client are downloaded to the other(s). First Sample Introduction This sample provides an introduction to using the Delphi edition of the RemObjects SDK product. The example shows how to define/implement methods on the server and how to access them from the client. The data consists of name information and four simple methods are provided by the service: Nicknames, VerifyName, CheckName and FullNames. FPC Server Architecture HTTP Chat Channels This shows how to use polled events to create an HTTP based chat program. The clients poll every few seconds for new messages and the server distributes the messages to the appropriate client(s). MegaDemo Channels This comprehensive example illustrates many of the features of the RemObjects SDK by providing benchmark facilities for the various protocols and channels supported. Multi Channel Introduction Channels Architecture This example provides an introduction to using the Delphi edition of the RemObjects SDK product. It shows how to use different channels to connect to the server application. Named Pipes (not shipped with the trial version) Channels Intermediate This example shows the use of a named pipe connection. It creates a named pipe server as a Windows service. Proxy Server Architecture Advanced This example shows how to create a proxy server to redirect the calls to another server without having to recreate the RODL file, thus allowing the use of the same types of the original server. This provides total control. As every call will pass from the proxy class before going to the real server, you can even stop methods from being dispatched any further. RODL (not shipped with the trial version) Introduction <to follow> Service Discovery Intermediate This sample illustrates how to use the TRODiscoveryClient and TRODiscoveryServer components. Each instance of the application acts both as a server and as a client. For the server, you can modify the list of services supported on the right-hand side, while for the client you can enter a service name and get a list of the servers available on your LAN to support it. Session Types Architecture Introduction This example shows the use of sessions and illustrates several SessionManagers: TROEventSessionManager, TROInMemorySessionManager, TROMasterServerSessionManager and TRODBSessionManager. Important note: this sample needs a "Sessions" table to be created in one of your databases. By default, the sample looks for the Sessions table in MSSQL's Northwind Database, but you can easily change to connect to any other database. Super TCP Channel Chat Introduction Channels This sample shows how the Super TCP Channel can be used to create a chat server and clients. Unlike the HTTP Chat sample, this sample doesn't poll the server but sends events back to clients directly. Time Server Introduction This is an extremely basic sample illustrating how to use the TROBroadcastServer and TROBroadcastChannel components. Variants Intermediate This example shows how the RemObjects SDK can transfer variants and array of variants from the client and server using the TROBinMessage and TROSOAPMessage message types.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值