0 votes


For my mobile game I need to check if user has a internet connection.
It will be used to decide is should show him a form to send a leaderboard entry to the server. Is there any easy way to do such check? Maybe some online/offline events like on the native Android?

in Engine by (56 points)

2 Answers

0 votes

you could just try to connect to the server with the leaderboard.
If no connection: do nothing or tell the player
If connection possible: update leaderboard

Check out HTTP client class:

this code snippet checks for a successful connection

by (291 points)
0 votes

You can use this script which is in my Github profile. I have explained "How can I implement?"

by (19 points)

Merhaba Çağdaş bey.

I am using Godot 3.2.3. I get the following error. how do i solve the problem? I need to constantly check the internet connection for a game.

HTTPRequest is processing a request. Wait for completion or cancel it before attempting a new one.

This error comes when the internet connection is lost.

resolvehostname: getaddrinfo failed! Cannot resolve hostname.

When I run the game without connection:
resolvehostname: getaddrinfo failed! Cannot resolve

Did you solve this problem?


I couldn't try it on Godot 3.2.3. You have to choose trusted hostname which has quick response such as www.google.com. I think, the problem is your host. It isn't resolving by Godot.

Hi, thank you for your answer.
I also use www.google.com. It gives this error when disconnected and continues until I reconnect. Connection quality can also be a consideration.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.