views:

110

answers:

2

...what options are there now with .NET 4.0, in a way that does support NAT for the client side (i.e. client behind NAT).

I would prefer to use something HTTP based, but that is a weak condition - I think mid term I will have some non http communication outside WCF anyway, so proxy traversal is something I could delay.

Pre .NET 4.0 there was the issue that basically the server->client channel would be opened from the server, which made NAT something non-traversable.

Polling is not acceptable - we talk time sensitive information here.

So, what are my options now?

A: 

This is not specific to .net 4.0, but you could use Windows Azure Service Bus.

If your application requires bi-directional connectivity you effectively have two choices: Either you bet on the available workarounds and live with the consequences (as BitTorrent does) or you build and operate some form of Relay service for your application. A Relay service accepts and maintains connections from firewalled and/or NAT-ed clients and routes messages between them. Practically all chat, instant messaging, video conferencing, VoIP, and multiplayer gaming applications and many other popular Internet applications depend on some form of Relay service.

The challenge with Relay services is that they are incredibly hard to build in a fashion that they can provide Internet scale where they need to route between thousands or even millions of connections as the large Instant Messaging networks do. And once you have a Relay that can support such scale it is incredibly expensive to operate. So expensive in fact that the required investments and the resulting operational costs are entirely out of reach for the vast majority of software companies. The connectivity challenge is a real innovation blocker and represents a significant entry barrier.

The good news is that Microsoft .NET Service Bus provides a range of bidirectional, peer-to-peer connectivity options including relayed communication. You don't have to build your own or run your own; you can use this Building Block instead. The .NET Service Bus covers four logical feature areas: Naming, Registry, Connectivity, and Eventing.

http://vasters.com/clemensv/PermaLink,guid,92d78bee-2cfd-4a29-95ab-c5abb9b905e7.aspx

Shiraz Bhaiji
+1  A: 

You can open a connection from the client and just keep it open. Or forward ports on NAT to clients, so connecting to NAT:34823 will go to 192.168.xxx.xxx:80. Or pay Microsoft some money to use their Service Bus, which is not exactly finished and with uncertain future. Or do some clever hack, install Skype on both clients and servers, send your messages trough the API.

John Grey