PING

PING
Windows supports an Internet Control Message Protocol (ICMP) to determine whether or not a particular host is available.
ICMP is a network layer protocol that delivers flow control, error messages, routing, and other data between Internet hosts. ICMP is primarily used by application developers for a network ping.

A ping is the process of sending an echo message to an IP address and reading the reply to verify a connection between TCP/IP hosts. If you are writing new application you will be better to use the Winsock 2 raw sockets support, implemented in Indy, for example.

Please note, however, that for Windows NT and Windows 2000 implementations, Raw Sockets are subject to security checks and are accessible only to members of the administrator's group. Icmp.dll provides functionality that allows developers to write Internet ping applications on Windows systems without Winsock 2 support.
Note that the Winsock 1.1 WSAStartup function must be called prior to using the functions exposed by ICMP.DLL. If you do not do this, the first call to IcmpSendEcho will fail with error 10091 (WSASYSNOTREADY).

Below you can find the Ping unit's source code. Here are two example's of usage.

1) Example 1 (code snippet):

uses Ping;
...
const ADP_IP = '208.185.127.40'; 
begin
 If  Ping.Ping(ADP_IP) then 
   ShowMessage('About Delphi Programming reachable!');
end;
 
 

2) Here's another, console mode Delphi program, that uses the Ping unit .. download.

And, the Ping unit's source:


转载于:https://www.cnblogs.com/ywangzi/archive/2011/12/28/2304559.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值