My game has previously connected using UPNP with my friends, using my public IP, but I cant connect when the exported version of the game is hosting (P2P), I've checked the ports using "netstat -ab" on cmd (i'm on windows) and the ports are opening correctly, but why the only in the exported version the connection cant host but still connect?

UPNP code

if discover_result == UPNP.UPNP_RESULT_SUCCESS:
			if upnp.get_gateway() and upnp.get_gateway().is_valid_gateway():
				var map_result_udp = upnp.add_port_mapping(PORT,PORT,"godot_udp","UDP",0)
				print("map udp:",map_result_udp)
				var map_result_tcp = upnp.add_port_mapping(PORT,PORT,"godot_tcp","TCP",0)
				print("map tcp:",map_result_tcp)
				
				if not map_result_udp == UPNP.UPNP_RESULT_SUCCESS:
					upnp.add_port_mapping(PORT,PORT,"","UDP")
					print("UPD created")
				if not map_result_tcp == UPNP.UPNP_RESULT_SUCCESS:
					print("TCP created")
					upnp.add_port_mapping(PORT,PORT,"","TCP")

(The prints are from early debugging)

ENet server

       peer = NetworkedMultiplayerENet.new()
	var result = peer.create_server(PORT)
	if result == OK:
		get_tree().set_network_peer(peer)

ENet Client

client = NetworkedMultiplayerENet.new()
	client.create_client(ip_address, DEFAULT_PORT)
	get_tree().set_network_peer(client)

When hosting from the editor, the game plays normally, its just when I try to host from an exported version. Thank you for your time.

  • Well, couldnt find the answer, but I am now using Gotm.io for my project, so it might help someone wanting to host an online game

DaveTheCoder Both on windows, havent tried Mac or Linux yet, even if I am the one to use the exported version to host, it doesnt

Well if anyone has any suppositions on what might be so I can look it up, i'd appreciate it. I really do not know a thing about actual networking.

5 days later

Well, couldnt find the answer, but I am now using Gotm.io for my project, so it might help someone wanting to host an online game