Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEngine
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.Close
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.Close
Ping any given IP address (given in dot notation).
The ping operation is asynchronous and a ping object can be polled for status using Ping.isDone.
When a response is received it is in Ping.time.
Windows Store Apps: A stream socket is used to mimic ping functionality, it will try to open a connection to specified IP address using port 80. For this to work correctly, InternetClient capability must be enabled in Package.appxmanifest.
Android: ICMP sockets are used for ping operation if they're available, otherwise Unity spawns a child process /system/bin/ping for ping operations. To check if ICMP sockets are available, you need to read the contents for /proc/sys/net/ipv4/ping_group_range. If ICMP sockets are available, this file should contain an entry for 0 2147483647.
|ip||The IP target of the ping.|
|isDone||Has the ping function completed?|
|time||This property contains the ping time result after isDone returns true.|
|Ping||Perform a ping to the supplied target IP address.|
Did you find this page useful? Please give it a rating: