Sends an IPv4 ICMP echo request, also known as ping, and returns any echo response replies.

IcmpPing(cArrayName, cHost [, nTTL [, nTOS [, nTimeout [, nDatasize [, bDontFragment [, nPingCount]]]]]])

Parameters

cArrayname

On return the array contains the following information:

If the ping succeeded

ColumnContentDatatype
1return IP addressC
2Roundtrip time in millisecondsN
3StatusN
4Data was retrieved back successfullyL


If the ping failed

ColumnContent
1empty string
2-1
3-1
4.F.
cHost

Either an IP address or a hostname.

e.g. "192.168.1.128", "www.google.com"

nTTL (optional)

default = 30

Time To Live for the network packet.

nTOS (optional)

default = 0

Type Of Service.

nTimeout (optional)

default = 3000ms

Timeout in milliseconds.

nDatasize (optional)

default = 32 (bytes)

Number of bytes to send.

bDontFragment (optional)

default = .F.

May the packet be fragmented?

nPingCount (optional)

default = 1

The number of pings to send, each ping result will be stored into a new row of the array.

Return Value

The number of executed pings.

See Also

Reference

AbortUrlDownloadToFileEx
AIpAddresses
ANetFiles
ANetServers
GetServerTime
Ip2MacAddress
ResolveHostToIp
SyncToSNTPServer
UrlDownloadToFileEx

Used WinApi functions

IcmpCreateFile
IcmpSendEcho
IcmpCloseHandle
gethostbyname