D
Doooooli
Guest
Hi! So i have a server that works connecting to, but i would like to add a text that shows if the server is on or not! the server is written in Python 3.5 (IDLE) and the code to check if the server is on in Python is:
So basically that checks if "myip" is reachable!
And this is the code i have in game maker:
Create event:
HTTP event:
and the draw event:
But the problem is it only writes null, so i can't tell if it's on or not :/ do anyone know what i should change to make it say like HTTP STATUS: Server Online or Server Offline thx
Code:
import client
conn = client.HTTPSConnection("http://myip")
conn.request("HEAD", "/")
r1 = conn.getresponse()
print (r1.status, r1.reason)
And this is the code i have in game maker:
Create event:
Code:
get_url = http_get("http://myip");
return_http_status = "null";
Code:
if ds_map_find_value(async_load, "id") == get_url
{
if ds_map_find_value(async_load, "status") == 0
{
return_http_status = ds_map_find_value(async_load, "http_status")
}
}
Code:
draw_set_color(c_orange);
draw_set_font(fnt_changelog);
draw_text(960,672,"HTTP Status:"+string(return_http_status))