PC IP Address

PC IP Address

Postby Jeff Barnes » 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
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby James Bott » Sat Oct 28, 2006 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Jeff Barnes » Sun Oct 29, 2006 2:27 pm

Thanks James.

Works perfectly.


Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests