Hosting a game on a PC - UDP or UPNP communication?

I've built a server-application for a game that I want general people to use. Now, since I've worked with client/server solutions before, I know how tedious it is to host connections on some computers.

So, I heard about these rumors that I would like to get confirmed.

  1. Using UDP for "hosting" a connection is good, because it is rarely blocked by router-firewalls compared to TCP.

  2. Using UPNP for communicating with a router is good, because it allows you to add port forwarding for the game, making your server reachable no matter if you're using TCP or UDP.

I don't care about the software-firewall people may use. What I care about is the router firewall functionality.

Any help would be appreciated.

Thanks!

Upvotes: 0

Views: 1146

Answers (1)

Scott Chamberlain
Scott Chamberlain

Reputation: 127553

For your two rumors,

  1. I don't know, I have not worked with firewalls enough, but I would not call that one true. Most routers block everything (TCP and UDP) unless you explicitly ask it to forward it for inbound connections via hand setup or UPNP. If you don't tell the router what computer wants info coming in to port 12345 how will it know what to do when a user sends a unsolicited packet to it (the definition of being a server).

  2. Yes, learning how to do UPNP will make it a lot easier for your users to host games, however you should still provide instructions for people who do not have UPNP turned on or their router does not support it.

The other thing you may want to look in to is learning how to add your program to the windows firewall client allowed list as that is what most of your users will have. See this SO question for more details.

Upvotes: 2

Related Questions