FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PC IP Address
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
PC IP Address
Posted: Fri Oct 27, 2006 10:56 PM

Hi Everybody,

I'm trying to have my program store the end users internal IP Address but I can not seem to get the actual address.

I am using:

GetHostByName( GetHostName() )

But it always returns 0.0.0.0

What am I doing wrong?

Thanks,
Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
PC IP Address
Posted: Sat Oct 28, 2006 02:34 AM

Jeff,

You must add WsaStartup() before the call to Gethostbyname() and add a WsaCleanup() after the call.

Try this:

Function GetIP()
Local cVar1
WsaStartUp()
cVar1 := GetHostByName( GetHostName() )
WsaCleanUp()
return cVar1

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
PC IP Address
Posted: Sun Oct 29, 2006 02:27 PM

Thanks James.

Works perfectly.

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion