Hi,
I didn't see a function in the Xbtools.
What is the easiest way to get the internal ip-address. The address shown with ipconfig.
Getting internal IP address
Re: Getting internal IP address
I noticed that Ot4xb from Pablo has IPCfg, would this work for you?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com
Re: Getting internal IP address
Hi Regan,
I would have thought that this was in ot4xb. I knew I saw it somewhere.
BTW, are you and/or Steve going to the Devcon?
I would have thought that this was in ot4xb. I knew I saw it somewhere.
BTW, are you and/or Steve going to the Devcon?
Re: Getting internal IP address
Steve expressed an interest in us doing so a while back but hasn't mentioned it since. I will be bringing it up as a topic of conversation shortly and will let you know. I hope so...skiman wrote:BTW, are you and/or Steve going to the Devcon?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com
Re: Getting internal IP address
Hi,
I downloaded the latest ot4xb, and tried the following functions:
I can't get them compiled. Unresolved external symbol.
If I check the include files, I can't find these functions. Also not in the DOC file.
I have ot4xb.lib and ot4xbcpp.lib in my project file.
Any suggestions?
I downloaded the latest ot4xb, and tried the following functions:
Code: Select all
aEval(_aGetAdapterInfo(.T.,.T.), {|o| DisplayAdapter(o) } )
aEval(_aGetTcpTable(.t.) , {|o| DisplayTcpConnection(o)})
aEval(_aGetUdpTable(.t.) , {|o| DisplayUdpConnection(o)})
If I check the include files, I can't find these functions. Also not in the DOC file.
I have ot4xb.lib and ot4xbcpp.lib in my project file.
Any suggestions?
Re: Getting internal IP address
did you have IPCFG.LIB / DLL ?skiman wrote:I downloaded the latest ot4xb, and tried the following functions:I can't get them compiled. Unresolved external symbol.Code: Select all
aEval(_aGetAdapterInfo(.T.,.T.), {|o| DisplayAdapter(o) } ) aEval(_aGetTcpTable(.t.) , {|o| DisplayTcpConnection(o)}) aEval(_aGetUdpTable(.t.) , {|o| DisplayUdpConnection(o)})
if not you have to use \Source\ipconfig.prg to build it
!need : advapi32.lib and Ws2_32.lib
... but there are other Version than IPCfg.zip which include IPCFG.LIB / DLL
search for Devcon 2007 WinApi_Tutor.zip ( 2.4MB )
greetings by OHR
Jimmy
Jimmy
Re: Getting internal IP address
Hi Jimmy,
Thanks to point me to the right direction. Also interesting PDF.
For who is interested in this.
http://www.xbwin.com/download/WinApi_Tutor.zip
Thanks to point me to the right direction. Also interesting PDF.
For who is interested in this.
http://www.xbwin.com/download/WinApi_Tutor.zip
Re: Getting internal IP address
Hi,
The following code returns an array with the IP adresses. It is based on ot4xb, see the above post.
The following code returns an array with the IP adresses. It is based on ot4xb, see the above post.
Code: Select all
Function GetIPAdres()
*********************
Local aInfo := _aGetAdapterInfo(.T.,.T.) , aReturn := {} , x , cIp := ""
if valtype(aInfo) == "A"
for x = 1 to len(aInfo)
cIp := aInfo[x]:aIPList[1]
if cIp # "0.0.0.0"
aadd(aReturn,cIp )
endif
next
return aReturn
endif
return {}
Re: Getting internal IP address
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "asinetc.CH"
#Pragma Library("asinet10.lib")
FUNCTION Main() // Get the IP address(es) of the local machine/returns array of dotted octet strings (example '192.168.0.102') or empty array if error
*constants from #include "Asinetc.ch"
* HOSTINFO_CNAME Character string containing the host name
* HOSTINFO_ALIAS One-dimensional array holding the alias names of the host.
* If no alias names exist, the array is empty.
* HOSTINFO_NTYPE Numeric value indicating address family.
* (always AF_INET for Windows sockets)
* HOSTINFO_NLEN Number of bytes required to encode the numeric IP address.
*
* HOSTINFO_ADDR One-dimensional array holding the numeric IP addresses
* of the host in network byte order.
******************************************************************************
LOCAL aHostInfo, nError := 0, aLocalIPaddress[0], i
aHostInfo := SocketGetHostByName('LOCALHOST',@nError) //Retrieves host information from a host name
if !Empty(aHostInfo)
aHostInfo:=SocketGetHostByName(aHostInfo[HOSTINFO_CNAME],@nError) //Retrieves host information from a host name
if !Empty(aHostInfo)
for i := 1 TO Len(aHostInfo[HOSTINFO_ADDR])
Aadd( aLocalIPaddress, SocketInetNtoA(aHostInfo[HOSTINFO_ADDR,i])) //Converts a numeric internet address in network byte order to a dotted octet string (returns 192.168.0.102)
next
endif
endif
wtf aLocalIPAddress pause
RETURN aLocalIPaddress
The eXpress train is coming - and it has more cars.