🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

best way to connect 2 random people around the world in winsock

Started by
2 comments, last by wodinoneeye 8 years, 11 months ago

I have a multiplayer game that works pretty good

Right now if I want 2 people in the same house connected one would need the LAN IP of the other computer

If I want 2 people in different countries connected one person needs to configure the wifi router to make port "X" connections go to "Y" IP computer inside his house and give the house IP to the other person

Now I would like to make 2 random people around the world connect by just pressing one button inside the game

nothing to configure just open the game, press the button and bam 2 random people connected

so whats the best way to do this using winsock?

Advertisement

If you have a central matchmaking server you can do NAT punchthrough to circumvent the need to do port forwarding.

Though its not 100% guaranteed to work so in some cases it might be necessary to route traffic through the central server, or do port forwarding manually, so take that into consideration. You can probably find statistics online for how well it works.

o3o

The FAQ (linked at the top of the networking forum topic list) has some links about NAT punch-through. For example, http://www.enchantedage.com/node/8
enum Bool { True, False, FileNotFound };

You also need that central server to recieve the "IM HERE" data to then log that IP to have the two sides be ready to link up (one calls for a connection to the 'random' other, is given the ID, then attempts one connection at time). Some state sequencing is needed because one would be the caller and the other a receiver. The NAT issues then need to be resolved. Im not sure of the details of direct peer-to-peer after the initial steps through to the central server(s)

--------------------------------------------[size="1"]Ratings are Opinion, not Fact

This topic is closed to new replies.

Advertisement