NET Remoting Bidirectional Tcp Channel

.NET Remoting Bidirectional Tcp Channel

by: Ingo Rammer

READ THIS FIRST: 09/03/2002 This channel is an early preview. It contains highly un-optimized and un-scalable code to just prove my concept of a bidirectional channel. I released it early to see if people are interested in a channel like this and to see if others will join me in adding features. Both is definitely true. Josh Prismon is currently working on turning my horrible socket code into something scaleable and I will also change the header serialization format to further increase its performance. Please check back in a week or two to download a more usable and scaleable version of this channel. Summary: Yes, you can download and develop with this channel now. No, you won't be happy if you deploy it now.

The package you are currently looking at contains a bidirectional TCP transport channel for .NET Remoting.

This channel aims to solve several problems related to events, callbacks and client-side sponsors when Remoting is used with clients behind NATs or Firewalls. Normally, with the built-in TcpChannel, Remoting tries to open a secondary connection from the server to the client whenever any of these features are used. This is a) necessary due to the TcpChannel's internal mode of operation in terms of "hard" request/response RPC and is b) problematic because normally, firewalls or NATs won't allow this secondary connection to be opened.

This BidirectionalTcpChannel works quite differently so that it allows the callback to employ the already exisiting connection which has been established by the client.

This is possible, because the channel internally works in an asynchronous, message oriented fashion so that request and response can share the same connection with a number of different simultanous requests and responses. The same connection will also be re-used for server-to-client callback requests and the client's response.

Download Information

CVS Module Name: BidirectionalTcpChannel
CVS Web: http://soap.4s4c.com/cvsweb/cvsweb.cgi/BidirectionalTcpChannel/
Download: BidirectionalTCPChannel.zip (66 KB)

Usage

You can register this channel on the client side with?

and on the server side with

The URLs for your objects have to look like "bidirtcp:// : / ", for example "bidirTcp://127.0.0.1:9999/testobj.rem".

PLEASE NOTE: Hostnames are not yet supported in the URLs, please use IP addresses in this first preview release.

Known issues

  • Needs support for automatic client reconnection include a server side timeout. Whenever the TCP connection drops due to network outages, the server should assign a grace period to the client. The server will in this case simply cache the event for some amount of time (like 10 seconds) and if the client reconnects during this time, no data is lost and no exception is thrown.?
  • It only works with IP addresses in the configuration file. It should however also support?
    hostnames.?
  • Performance: Too many new Threads. Will port to ThreadPool usage later.

Internals

As soon as a process is started, a GUID is assigned to it. Whenever a TCP connection is established, the two peers' GUIDS are exchanged. From this point on, the endpoint identifier is the GUID. When the client later passes an object to the server (callback interface or delegate), this GUID will be part of the dynamically generated ObjRef which contains the endpoint URLs for this object. If the server now calls this object, it will not see a URI like tcp://somehost:1234/URI/to/your/object (which would trigger the creation of a new connection from server to client) but instead at BidirTcpGuid://b28c92ed-d4b9-4fa6-a248-f5362caec380. The server will then check its connection table and retrieve the connection which corresponds to the GUID b28c92ed-d4b9-4fa6-a248-f5362caec380 to send the reply. The most important part is that the complete processing model for the underlying TCP connection has been changed: whereas the "normal" TcpChannel uses a request/response style connection oriented protocol, the BidirTcpChannel uses a message oriented protocol with correlation IDs to find matching request and response messages. That's somehow the only way things like this will work when you have only one connection available. However, this also means that this channel is not your average remoting channel and if it's the first one for you to look at, you might be a little shocked. But trust me, normal channels are way easier to understand ;)

FAQs

Q: Is this web service or GXA related?
A: No, not at all. It's completely non-GXA, non-WebService and will not cooperate in any way with any WS-* specification. It's purely for applications where you use .NET at the client and server side.

Q: Is this thing supported in any way?
A: No. But please send feedback to me at rammer@sycom.at and I'll try to?
work on your issues whenever I get the time to do so.

Q: Can I use it in commercial production applications?
A: Yes. But without any warranty or support. Please see the license which is printed below and which can be found in the source code files.

Q: Is this channel from Microsoft?
A: No. It's been developed solely by an independent developer.

Q: Can we hire you as a consultant?
A: Glad you asked ;-)

I'm consultant, author, speaker, trainer and developer - mainly for distributed .NET applications. I'm available for technical and architectural consulting,? on-site training and development throughout Europe.?

If you currently look at developing a distributed .NET application, think about designing/implementing an application framework, or just like what you see here and think that you need a hardcore .NET person on your project, please don't hesitate to contact me at rammer@sycom.at.

My services include: custom training, design, prototyping & architectural review. I'm not normally available for long term project development. But if you are working on something exceptionally interesting - who knows? ;-)

Q: What's the license of this component?
A: This component is covered by a liberal BSD/X11 style open source license. It therefore allows you to modify, share, use (even in commercial applications) this channel without any warranty and on your? own risk. You however must not remove the copyright statement.The complete license can be found here.

Q: Can this channel be linked with GPL software?
A: Yes. The X11 license we use is compatible with the GPL.

Documentation

More documentation to follow. In the meantime, please refer to the Demos-subdirectory of this module which contains a sample for its use.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值