English 中文(简体)
How to let Server Notify Client Behind Firewall
原标题:

I have the case where I have a public facing service sitting out on the internet and I would like the ability for the server to contact specifically design embedded devices that are sitting in normal home networks when required.

I know that the devices can poll the server to get updates etc but 1) There will be a lag between when server does something, and device polls for update and 2) There will be a lot of useless traffic (over time) generated.

Does anyone have any suggestions on how to do this? My initial though is to have the embedded devices use UPNP to try and generate a port forward rule in the home router, and then register that port to the server. The server can then generate a HTTP request to that address (http so that it will get routed etc without being blocked by firewalls etc along the way). If the device cant create the forward rule then it will resourt back to the polling method.

Does this sound about right? Anyone have any experience they could share with this sort of thing? (Client will be c++ on embedded linux, server .NET).

最佳回答

A lot depends on how many devices / networks you think this going to be used with and what control you have over their software/configuration.

Since you re talking about UPNP, it implies that there will be lots of client networks - unless you have control over the router config / hardware, you re going to have lots of problems getting the UPNP solution to work reliably.

Also, you mention portforwarding which rather suggests that the embedded devices will not have real IP addresses.

You say that you want to use HTTP to avoid it being blocked however the majority of firewalls/routers etc aren t that smart - blocking is done purely on port numbers. If you ve got multiple devices behind a NAT router, then you ll have to use non-standard ports to address the devices unless you implement a controller to relay requests based on the HTTP content.

The only practical solution I can see is having the embedded devices connect to the server and wait for an event to occur.

C.

问题回答

暂无回答




相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签