Creating a local server visible through firewalls

I have a local server written in C++ listening to inbound TCP connects using plain socket ::accept() and UDP recvfrom(). I have two problems with this that I wish to solve:

  • Can I programatically make Windows let me open the accept socket without it automatically being blocked by the Windows (software) firewall?
  • Are there any ports I can use that will allow my packets to pass through both Windows firewall and external firewall? Port 80 is often taken by things like Skype, but are there others? Will most external firewalls typically by default allow incoming UDP and TCP connects on port 80?



You probably want to look at something more conducive to desktop environments such NAT traversal techniques as libjingle, STUN, or an overlay network such as XMPP.

In general, network routers need Port Forwardng enabled for the listening port, and firewalls need the listening port opened. If you are using a uPNP-enabled firewall/router, then you can dynamically set up those settings programmmably via the uPNP API. But more times than not, uPNP is either disabled or unavailable, requiring manual settings by the firewll/router admin.

Need Your Help

How to read in special keys with Win32::Console?

perl terminal

When I press the Up-key, this script (Term::TermKey) outputs You pressed: <Up> .

cin.getline() is skipping an input in C++

c++ string getline cin

If I use the following code, getline doesn't take the last input(for last iteration of "for" loop, it simply skips it) -