How to make normal host, so it's gonna be working by ip address

Godot 4.2.1

Hello guys, i was trying to make multiplayer for me and my friend by video from DevLogLogan. When he was cheking so upnp gotta work fine, my worked fine from 1st try, but then he told to change “localhost” to var address_entry.text. It bassicaly means that you need to wrote ip and then connect, but my game only working in local host, how could i fix that?
here’s when it’s working but in local host: enet_peer.create_client(“localhost”, PORT)
and here’s when it doesn’t working: enet_peer.create_client(address_entry.text, PORT)

What are you typing into address_entry.text? What is the error message?

To connect to other computers you will need something other than localhost, as localhost means “connect to myself”

in address_entry i’m writing ip

writing “ip” or something like “192.168.1.123”?

like second
adress_entry is a LineEdit

Yes, when connecting as a client, what are you typing into the line edit? What error appears if any?

when i creating server i got printed my ip, and then i paste it into this line edit pressing join and nothing happens.It’s don’t show any errors

So if it works with localhost you can type localhost into that field, but you’ll be connecting to your own computer.

Whatever is printing your IP address could be a local one, usually starting with 192.168 which will work for other computers in your network. Or your network’s IP address which will only connect from outside your network.

so it’s only works in my local network?

You will have both a local IP address (starts with 192.168) and a internet IP address (could be anything) to find out your internet IP address you will simply have to google “what’s my ip?” as other servers can easily tell you your ip, but your computer doesn’t know by itself.

If you give your internet IP address to your friend, they can type it in to connect to your server. If your friend is hosting a server, they will have to tell you their IP address.

alright
lemme try :slight_smile:

omg! thanks! it’s actually works

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.