Reputation: 19873
I have a situation where a desktop application (c#) client needs to receive connections from a server. To avoid forcing the client to open up ports in their NAT, someone suggested to use http persistent connections initiated by the client instead. I'm not sure this is the right solution however as it seems to be somewhat of an abuse of this http extension. It's this solution ok or is there any better alternative I should look into instead?
Upvotes: 1
Views: 54
Reputation: 598134
To receive an inbound connection through a NAT, a port must be opened on the NAT and mapped to the IP address of the target PC. If uPNP is enabled on the NAT, the port can be opened and mapped programmably by the target app, otherwise the NAT admin has to open the port.
The other option is to make an outbound connection instead. It does not have to be on an HTTP port (unless the NAT is locked down by the admin), though that is the most common port used as most NATs/firewalls allow outbound connections to port 80 to allow web browser traffic. The receiving server does not have to be an actual HTTP server.
Upvotes: 2