- Home /
Checking internetReachability from another Thread
I have to check internet reachability from a separate thread (which is activated every N seconds, and check for reachability, so i cannot cache the reachability before starting the thread)
1) I have to do this job in a separate thread and not in a coroutine / monobehaviour
2) I Can't use Application.internetReachability or the Ping class, as they don't work on a separate thread
3) The .net Ping class seem to have a bug in the mono version distributed with unity and raises an exception all the time.
i want to avoid having a monobehavior just to check reachability, as it would be a library and i wanted to avoid using the unity runloop when possible.
Any suggestions on a possible solution?
Answer by ArkaneX · Dec 11, 2013 at 10:56 AM
Please check this Stack Overflow question and my answer to similar question build on top of the SO one. It is independent from Unity classes, so can be used on separate thread.
Using test result, you can update a bool field/property which is visible in the main thread.
Thanks, this works. probably slower than the ping but doesnt matter.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Data keeps "hanging". TCP client/server 2 Answers
how to find out if player hosted game 1 Answer
Multiple Cars not working 1 Answer
C# Networking Issue 1 Answer