Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

Et the IP Address bhind a routerproxy

Title: et the IP-Address bhind a router/proxy? { WennmanhintereinemRouteroderProxyseinerichtigeInternet-IPherausfindenmchte, dannbrauchmandieHilfevoneinemexternenInternetserver,dereinemdieIPverrt. RealisierbaristdiesmiteinerKombinationvonPERLundDELPHI. DasfolgendePerlscriptmussaufeinenWebspace,derCGI/Perluntersttztgeladenwerden: IfyouarebehindarouterorproxyandwanttogetyourrealInternet-IP-Addressthenyou needthehelpofaexternInternetServer.ThatexternInternetserverhavetotellyouyour realIp-Address.YoucanmakethiswithacombinationofPERLandDELPHI. ThefollowingPERL-SCRIPTyouhavetouploadtoanWebspacewitchallowsPerl/CGI-access: } -------------------------------------------------------- #!/usr/local/bin/perl useCGIqw/:standard/; print"Content-type:text/html\n\n"; print"BEGINIP".$ENV{REMOTE_ADDR}."ENDIP"; -------------------------------------------------------- { WenndieAdressedesScriptshttp://www.my-server.de/cgi-bin/GiveMeMyIp.plist, dannistderDelphiQuelltext,umdieIPrauszufinden: IftheaddressoftheScriptis"http://www.my-server.de/cgi-bin/GiveMeMyIp.pl" thentheDelphi-CodetogetyourrealIPis: } procedureTForm1.Button1Click(Sender:TObject); var IPSTR,IP,HP:string; BeginIP,EndIP,i:integer; begin Button1.Enabled:=False; HP:=http://www.my-server.de/cgi-bin/GiveMeMyIp.pl; NMHTTP1.Get(HP); IPSTR:=(NMHTTP1.Body); BeginIP:=Pos('BEGINIP',IPSTR)+Length('BEGINIP'); EndIP:=Pos('ENDIP',IPSTR); IP:=''; fori:=BeginIPtoENDip-1do begin IP:=IP+IPstr[i]; end; label1.Caption:=IP; Button1.Enabled:=True; end;