Nonexistent function 'is_connected_to_host' in base 'StreamPeerTCP
Asked Answered
C

4

0

Hi everyone, I was trying to establish a connection TCP connection to a client, but I keep getting a
Invalid call. Nonexistent function 'is_connected_to_host' in base 'StreamPeerTCP' error. I have no idea why this happens, this function definitely exists because it's in the docs, yet here I am. Also, if I comment the call, I get another error Invalid call. Nonexistent function 'remove' in base 'Array'. when trying to remove an element from an array, which is suspicious to say the least. I'll link the code snippet in case it's necessary

for client in connection:
			if !client.get_status() == 0:	
				print("Client disconnected \n")
				var index = connection.find(client)
				connection.remove(index)
				peerStream.remove(index)
Cyanogen answered 4/5, 2023 at 9:35 Comment(0)
P
0

That is a Godot 3 function. It doesn't exist any more in Godot 4. You probably want get_status instead. See here: https://docs.godotengine.org/en/stable/classes/class_streampeertcp.html)

Paleoecology answered 4/5, 2023 at 9:56 Comment(0)
C
0

Paleoecology that solved it, and same thing for the remove method, now it's remove_at. Thank you! The wiki should be updated though, it's confusing

Cyanogen answered 4/5, 2023 at 10:1 Comment(0)
P
0

Cyanogen The wiki should be updated

What's the link to the Wiki?

Porter answered 4/5, 2023 at 11:10 Comment(0)
C
0

Porter I checked again and the wiki for 4.0 is ok, I must have accidentally browsed 3.6(?)

Cyanogen answered 4/5, 2023 at 11:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.