Creating a local server visible through firewalls

可紊 提交于 2019-12-11 10:59:15

问题


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?

Thanks!


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/3590903/creating-a-local-server-visible-through-firewalls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!