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

socket.gethostbyname(hostname) might not return a correct ip #6

Open
dille12 opened this issue May 14, 2022 · 14 comments
Open

socket.gethostbyname(hostname) might not return a correct ip #6

dille12 opened this issue May 14, 2022 · 14 comments

Comments

@dille12
Copy link
Owner

dille12 commented May 14, 2022

Friend of mine checked the multiplayer tab and the ip text bar showed his local ip, even though it should be his public ipv4 address. ipv4 is crucial for the multiplayer. Can anyone check the tab and see if your correct ipv4 shows up?

@mark-pippin
Copy link
Contributor

It's showing my local LAN IP [and oddly has a hyphen and a 1 displayed in the first char slot, overlayed]

@altruios
Copy link
Contributor

Local LAN IP here as well.

@dille12
Copy link
Owner Author

dille12 commented May 14, 2022

Okay I read more about it and the line is supposed to return your local IP. I wished that you could play this without any extra software, but it seems like only way to play this online is to use a VPN like Hamachi. (The hyphen is a different textsurface that I accidently left there)

@dille12 dille12 closed this as completed May 14, 2022
@mark-pippin
Copy link
Contributor

I haven't looked at the network code - but simple port forwarding for the hosting system is likely a solution. uPnP could be used to auto configure routers that have it enabled.

Also, it should be fine on a LAN (lan parties are fun!)

@dille12
Copy link
Owner Author

dille12 commented May 14, 2022

I'm using the same network framework that I used for a pygame cardgame half a year ago, Hamachi worked really well back then when I played it with my friends, but it's a hassle to download a VPN for this. I think port forwarding might be the way, i'll have to look into that.

@mark-pippin
Copy link
Contributor

it looks like you're using socket and not specifying protocol, and I believe it defaults to TCP. So, fowarding TCP port 5555 on a give router to the LAN IP of the hosting PC at the router, and assuming PC has no local firewall, then connecting to the public IP of the router from the internet based client should just work.

@dille12 dille12 reopened this May 14, 2022
@mark-pippin
Copy link
Contributor

FYI - I'm looking at adding the option to automatically create the port forward if a users' router has upnp enabled.

I found a nice bug in uPnPy library, which I have fixed. We may have to include my patched version in this project, as the maintainer seems a bit inactive.

I'll also work on a guide for manual router config.

@dille12
Copy link
Owner Author

dille12 commented May 15, 2022

Sounds incredible, looking forward to seeing this

@mark-pippin
Copy link
Contributor

Ok - uPnP is an option, but not a GOOD option.

I now have a GOOD option in the works. You'll like it.

I'll tackle the networking for multiplayer without external VPN required, but it may be a week or two for me to have time.

@dille12
Copy link
Owner Author

dille12 commented May 17, 2022

Take your time, I'm sure it's gonna be awesome. I'll be ironing out the multiplayer meanwhile

@mark-pippin
Copy link
Contributor

Absolutely - keep pumping out cool new stuff. I'll do my best to smash this headache for you.

@woesbot
Copy link

woesbot commented May 22, 2022

Ok - uPnP is an option, but not a GOOD option.

I now have a GOOD option in the works. You'll like it.

I'll tackle the networking for multiplayer without external VPN required, but it may be a week or two for me to have time.

I'm curious what's the plan?

@mark-pippin
Copy link
Contributor

woesbot - the plan ran into troubles due to lack of support on windows for an underlying protocol I planned to bring in.

However - i still have a plan. As of right now - adding unit tests to the network facing code.

Soon thereafter - adding uPnP - it will help some. After that, introducing some interesting low level things [below socket].

I am network engineer by trade - quite familiar with all the options and all the corner cases users may present from a topology/connectivity standpoint.

Join us in discord if you want more info, etc!

@altruios
Copy link
Contributor

Discord info is in the readme section :)

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

No branches or pull requests

4 participants