T Get Public IP

时间:2014-10-06 02:35:04
【文件属性】:

文件名称:T Get Public IP

文件大小:208KB

文件格式:ZIP

更新时间:2014-10-06 02:35:04

取本机上网IP

TGetPublicIP ------------ This component obtains the public IP address, or Internet IP address, for computers that are behind routers with NAT functionality. It works contacting with any server on Internet that tells your public IP, and doing parsing with the reply data to get the address. By default it asks to: http://checkip.dyndns.org but you can change to another server, setting the component properties, if desired. TGetPublicIP don't blocks the application while the process is pending. To start the process you must call the method "Execute". It returns inmediately. When the process finalizes the event "OnDone" is called. Then you can read your public IP in the property "PublicIP". If the process fails, "OnDone" never will be called, so your program should take care for a timeout period. Internally it uses the component TClientSocket that is in the package dclsocketsXX.bpl. This package is not usually installed on recent versions of Delphi. So you should install it before to use TGetPublicIP. Properties ---------- ServerAddress: This is the domain name or IP address for the server that you use to get your IP. By default "checkip.dyndns.org" ServerUrl: The entire url of the WEB page for the query. By default "http://checkip.dyndns.org" DetectString: This is a string that must be just before the IP address in the reply data. TGetPublicIP finds this string and asumes that the IP is just after it. You should set this property if you use another server than the default. PublicIP: Initialy it's an empty string. When the query finalizes, here you have your public IP address. To know when the process is finished you can wait for the execution of the event "OnDone", or for this property is filled. Events ------


【文件预览】:
GetPublicIP_sample
----Project1.res(876B)
----Unit1.dcu(4KB)
----Project1.dsk(5KB)
----Unit1.dfm(851B)
----Project1.cfg(400B)
----Project1.dpr(188B)
----Unit1.~dfm(851B)
----Project1.exe(375KB)
----Project1.dof(1KB)
----Unit1.~pas(696B)
----Unit1.pas(696B)
accGetPublicIP.txt
accGetPublicIP.dcr
accGetPublicIP.pas

网友评论