Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to connect server and clients if they are behind NATs? #31

Open
Trilarion opened this issue Jul 31, 2017 · 5 comments
Open

How to connect server and clients if they are behind NATs? #31

Trilarion opened this issue Jul 31, 2017 · 5 comments

Comments

@Trilarion
Copy link
Owner

Trilarion commented Jul 31, 2017

I'm not an expert on this but it needs to be solved in order to allow multiplayer games.

The question is how two peers behind routers/network address translations discover and connect to each other? See for example: https://en.wikipedia.org/wiki/Network_address_translation#Type_of_NAT_and_NAT_traversal.2C_role_of_port_preservation_for_TCP

@Trilarion
Copy link
Owner Author

It seems port forwarding using UPnP/IDG might be the easiest possible solution if the router supports it.

See: https://stackoverflow.com/a/28652219/1536976

@krs013
Copy link
Contributor

krs013 commented Aug 1, 2017

I don't think this is something we need to worry about. As long as the program opens the port and maybe reports the port and IP address, we can leave the rest to the users. Works for Minecraft.

Repository owner deleted a comment from jkfindeisen Aug 1, 2017
@Trilarion
Copy link
Owner Author

What tools do users of Minecraft use to implement port forwarding? If there are convenient tools out there, I agree that we don't need to do that ourselves. A little recipe for how to use them might be worth an entry in the FAQ.

Getting the public IP is actually something we do not have yet. The network code only delivers the local IP if behind a NAT. But there is for example ipgetter.

@krs013
Copy link
Contributor

krs013 commented Aug 1, 2017

I mean, I wouldn't go so far as to say that there are convenient tools... When I've set up servers I just set up ports at the router level since I run the network. Bigger servers are usually run on remote servers that have setup like that built in.

I guess I shouldn't talk about it like it's a solved problem, but it's something that many users can handle on their own, so I wouldn't worry about it for now. But if there's a way to do it with UPnP or something similar, and a use for that kind of mechanism in testing, it might be worth trying.

@Trilarion
Copy link
Owner Author

Okay. As a first step, I displayed the "real" IP address using ipgetter. The rest is for later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants