Tono Nam
Tono Nam

Reputation: 36048

Send notification to computer behind nat

I have a computer called Server and I have several computers called Nodes. The nodes are behind a NAT (router) and Server is not. In other words each node can connect to Server but Server cannot connect to a node.

In short I want to send a notification from Server to a Node

How should I implement this? I need to send a very simple notification and if a node receives that notification it will perform a specific action. Just out of curriosity take for instance Drop Box. The moment you modify a file it starts updating it right away on a differnt computer. How they do this? Do they use polling?

edit

This is what I believe will be the best solution:

Since the server is running my code and also the client. I will have the clients send UDP packets every 30 seconds. The server then can reply back and the NAT will enable traffic to pas. So whenever I want to notify a node I basically will have to send a packet. This solution is like inventing something new though. From experience every time you invent something new I have bad success. But it sounds like a good idea.

Upvotes: 0

Views: 474

Answers (1)

Gildor
Gildor

Reputation: 2574

Unfortunately that's not your invention. That's the way eMule has been using to connect to clients behind NAT. It works indeed. Just keep in mind that you can only use UDP in this way.

Meanwhile, if you want to make something quickly and reliable (maybe), why not try some 3rd party services like Service Bus of Windows Azure? Then you can focus on your logic, not the underlying details.

Upvotes: 1

Related Questions