delphi 怎么ping计算机名或ip 地址 Delphi / Windows SDK/API http://www.delphi2007.net/DelphiNetwork/html/delphi_20061201140126219.html
delphi 怎么ping计算机名或ip 地址???
indy idICMP
function TMainForm.ping( var url: string):boolean; var aIdICMPClient: TIdICMPClient; begin aIdICMPClient:= TIdICMPClient.Create(nil); aIdIcmpclient.ReceiveTimeout:=500; aIdICMPClient.Host:= url; try aIdICMPClient.Ping(); except Result:= False; end; if (aidicmpclient.ReplyStatus.fromipaddress<>'0.0.0.0') and (aidicmpclient.ReplyStatus.fromipaddress<>'') then result:=true else result:=false; aIdICMPClient.Free; end; 我这里能ping 通ip地址,但是ping 不通计算机名? 为何
在“CMD”里面Ping一下看 另外,如果操作系统是XP,有时是Ping机器名时是Ping不到的
在HOSTs文件里面加一条就可以了:(XP: C:\WINDOWS\system32\drivers\etc目录下) # Copyright (c) 1993-1999 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost #把你的IP和HOST按下面格式输入 200.211.110.133 SANMAOTUO
如果加上楼上说的.肯定是可以通的. 但是局域网内丑那么多电脑.我不可能没一台都去改一下hosts文件吧 .好像是dns的问题. 我本来想用api把名字解悉为ip,但是如果不在hosts里面加的话。解析不出来。 有没有别的办法啊。。 高手们,帮帮我把
路过
|
请发表评论