FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Find my ip
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Find my ip
Posted: Sun Aug 15, 2010 12:19 PM

Hi all,
anyone know how can I get my computer ip ?

Thanks

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM
Re: Find my ip
Posted: Sun Aug 15, 2010 02:28 PM

Public or Private

Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Find my ip
Posted: Sun Aug 15, 2010 02:51 PM
Code (fw): Select all Collapse
/* Purpose: Find Internet IP address
Note: Must also link xHarbour\source\tip\url.prg
                                   xHarbour\source\tip\client.prg
I have not tested this - J Bott
*/



#include "fivewin.ch"
#include "tip.ch"


function main()
   msgInfo( getMyIP() )
return nil

function GetMyIP( cURL )
   local cMyIP := ""
   local oUrl, oClient
   cURL := if( empty(cURL), "http://www.whatismyip.org/", cURL )
   oUrl := tURL():New( cURL )
   if !empty( oUrl )
      oClient := tIPclient():new( oUrl )
      if !empty( oClient )
         oClient:nConnTimeOut := 20000
         if oClient:Open( oUrl )
            cMyIP := oClient:Read(80)
            oClient:Close()
         endif
      endif
   endif
return cMyIP
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Find my ip
Posted: Mon Aug 16, 2010 05:19 AM
Hi,

To get the LAN/Internal IP

Code (fw): Select all Collapse
#include "FiveWin.Ch"
//---------------------------//
Function Main()

   Local cMyLAN_IP

   WsaStartUp()
   cMyLAN_IP := GetHostByName( GetHostName() )
   WsaCleanUp()

   MsgInfo("Your current LAN IP-address is : " + cMyLAN_IP )

Return


Regards
Anser
Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
Re: Find my ip
Posted: Mon Aug 16, 2010 03:02 PM
HI, see this code,,,,
Code (fw): Select all Collapse
//--------------------------------------------------------------------------------------
Function GetIp(oWnd)
local nIp,oSocket,cIp, nLen

oSocket := TSocket():New( 2000 )  
cIp := oSocket:cIPAddr
oSocket:End()
cIp := If(Empty(cIp),"127.0.0.1",cIp)
Return(cIp)
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: Find my ip
Posted: Tue Aug 17, 2010 06:04 PM

I was looking for the internal ip.
Thank to all for the support.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 3
Joined: Mon Sep 03, 2012 06:55 AM
Re: Find my ip
Posted: Mon Sep 03, 2012 07:15 AM
Marco Turco wrote:Hi all,
anyone know how can I get my computer ip ?

Thanks



What ip address do you need?
If you need your computer ip do the following instructions
For Windows xp
1.start->Run
2.cmd
3.Type ipconfig
4.press enter
If you need your internet ip address visit ip-details.com .Here you can get location of your ip, longitude.latitude also

Continue the discussion