Search code examples
network-programmingxnanat

How do I make my game connect to a server without real IP address?


I'm making an XNA game. When I started, I had a broadband connection with real IP, so I could host servers of any kind without any problem, but now I don't have that connection any more and I want to be able to let players from outside my local network connect to my server again. How do I do that? How do big guys at studios do that?


Solution

  • Generally there are two ways to connect two clients:

    1. Give each client other client's IP address and let them connect to each other.
    2. Give each client a mid-server's IP address and tunnel the traffic through it.

    First way assumes each client has a real IP address and they both can be a server to one another. Second way is for when one or both clients don't have real IP address.