I'm struggle with what technique to choose for a server client aspect of my application.
Defining design
- Windows, C# on .net 2
- On many machines there is a .net 2 service. I call that the Client.
- Machines can be in different networks behind NAT's (or not) connected to Internet.
- Server services are public.
Requirements
- To communicate with the Clients on demand.
- Client must listen for incoming connections.
- The server can be or not online.
- Port forwarding is not possible.
What are my choices to do something like that? Now I'm looking in the UDP Hole punching technique. The difference between the UDP hole punching technique setup and my setup is that instead of having 2 clients behind a NAT and a mediation Server, I got only the client behind the NAT that must communicate with the server. That must be easier but I'm having hard time to understand and implement. I'm on the right way with the this kind of NAT traversal or may be some other methods much easier to implement?
Other methods that I've taken in consideration:
When the service sees the server online, creates a connection to the server using TCP. The problem is that I have something around 200 clients, and the number is rising and I was afraid that this is a resource killer.
When the service sees the server online, checks a database table for commands then at every 30 seconds checks again. This is also a resource killer for my server.
Bottom of line is, if the UDP Hole Punching tehnique is the right way for this scenario, please provide some code ideas for de UDPServer that will run on the service behind NAT.
Thank you.