Check Online Module

Monkey Programming Forums/User Modules/Check Online Module

Skn3(Posted 2013) [#1]
This is a module to Check IsOnline()

You can find the module here:

It currently supports:
- Android
- iOS
- html5
- glfw (windows)
- possibly windows8 and windows phone 8 (windows phone 8 SDK sux major balls)

If anyone has some spare time, please help out and complete some of the target code.

Enjoy, for free :D

computercoder(Posted 2013) [#2]
Good job! Thanks for posting :)

rIKmAN(Posted 2013) [#3]
Very handy - thanks!

Skn3(Posted 2014) [#4]

'version 2
' - updated to add IsOnMobileNetwork()

ziggy(Posted 2014) [#5]
I love it

Raz(Posted 2014) [#6]

Awesome :D

Sensei(Posted 2014) [#7]
Tried this in my code and it worked lovely... until I tried it in GLFW and Ouya builds.
On the Ouya you get garbage outputs to the console and the game isn't able to access the internet as it thinks it's offline due to the IsOnline() method not working.
On GLFW build it fails with a trans error. I use MinGW to compile it with.
g++ -Wno-free-nonheap-object -I../glfw/include -I../glfw/lib -I../glfw/lib/win32 -I../openal/include -I../stb -c -o ../main.o ../main.cpp
g++ -Wl,--subsystem,windows -L../openal/libs/Win32 -o Debug/MonkeyGame ../glfw/lib/enable.o ../glfw/lib/fullscreen.o ../glfw/lib/glext.o ../glfw/lib/image.o ../glfw/lib/init.o ../glfw/lib/input.o ../glfw/lib/joystick.o ../glfw/lib/stream.o ../glfw/lib/tga.o ../glfw/lib/thread.o ../glfw/lib/time.o ../glfw/lib/window.o ../glfw/lib/win32/win32_dllmain.o ../glfw/lib/win32/win32_enable.o ../glfw/lib/win32/win32_fullscreen.o ../glfw/lib/win32/win32_glext.o ../glfw/lib/win32/win32_init.o ../glfw/lib/win32/win32_joystick.o ../glfw/lib/win32/win32_thread.o ../glfw/lib/win32/win32_time.o ../glfw/lib/win32/win32_window.o ../stb/stb_image.o ../stb/stb_vorbis.o ../main.o -lgdi32 -lopengl32 -lOpenAL32 -lws2_32
../main.o:main.cpp:(.text+0xa23a): undefined reference to `InternetGetConnectedState@8'
../main.o:main.cpp:(.text+0xa2c9): undefined reference to `InternetGetConnectedState@8'
Makefile:23: recipe for target 'Debug/MonkeyGame' failed
c:/development/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ../main.o: bad reloc address 0x4 in section `.data'
TRANS FAILED: Error executing 'mingw32-make CCOPTS="-Wno-free-nonheap-object" OUT="Debug/MonkeyGame"', return code=2
c:/development/tdm-gcc-32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Debug/MonkeyGame] Error 1

I since removed this from my game and have worked it another way by doing an httprequest to my VPS.

I'm guessing the module hasn't been updated for some time since Monkey has been updated and also the Ouya and other bits might not be covered in this?
A pity really as I liked using it.

Skn3(Posted 2014) [#8]
Sorry, this was updated fairly recently but just not had time for anything monkey recently. Which is very saddening!

Just finished a project on Friday so *hopefully* have some spare time this coming week to update some of my modules.

I don't have a ouya to test unfortunately. I'll try and give the module some more testing in android devices next week.

Famous last words from me...

Sensei(Posted 2014) [#9]
Thanks Skn3. I love your stuff. I've successfully implemented your QR code stuff in my game and am trying out a few ways of using it in a fun collaborative way to enhance the gameplay experience.
TBH, the IsOnline() thing isn't such a train smash because when you do a brl.httprequest and get a -1 status you know you're offline anywya, so I've just used that instead as a boolean value for other bits of the game.
I'm probably going to be using your AES encryption code too, so many thanks for your cool stuff.