Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #5160

Re: IP Address function

From Massimo Bighelli <info@arcasistemi.it>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: IP Address function
Date 2013-04-26 18:07 +0200
Organization ARCA Sistemi S.r.l.
Message-ID <kle8o8$amp$1@speranza.aioe.org> (permalink)
References <_1xet.160753$ui1.20601@fx02.fr7>

Show all headers | View raw


Martin,

this is my code:

sHost := AllTrim(HostName())
SELF:oDCwIP:value := GetIPAddress(sHost)

Massimo


Il 26/04/2013 17:28, Martin ha scritto:
> I am trying to find my PCs IP address from within VO, I found this in
> our code and I am trying to test it.
>
> My address is 192.168.2.232 this returns 16.243.24.0
>
> The second debug through a converter gives me 232.2.168.192
>
> Any ideas what is wrong please?
>
> Thanks
>
> Martin
>
> FUNC GetIPAddress1(cHost AS STRING) AS STRING PASCAL
>      //  Takes a address string and returns IP string
>      LOCAL cRet      AS STRING
>      LOCAL pHostEnt  as _WInHostEnt
>      LOCAL Tmp1 as DWORD // VO 2.8 PHIL
>      LOCAL Tmp2 as DWORD
>      LOCAL Tmp3 as _winin_addr
>      LOCAL Tmp4 as psz
>
>
>      IF SLen(cHost) > 0
>          pHostEnt := gethostbyname(String2Psz(cHost))
>
>          IF pHostEnt != null_ptr
>              // VO 2.8 PHIL - changed data types
>              Tmp1 := DWORD(pHostEnt.h_addr_list)
> hit_key(str(tmp1))
>              Tmp2 := DWORD(ptr(_cast, Tmp1))
> hit_key(str(tmp2))
>              Tmp3 := @Tmp2
>              Tmp4 := inet_ntoa(Tmp3)
>
>              cRet := Psz2String(Tmp4)
>          ENDIF
>      ENDIF
>
> RETURN cRet


*Massimo Bighelli* ARCA Sistemi S.r.l.

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

IP Address function Martin <spam@spam.spam> - 2013-04-26 16:28 +0100
  Re: IP Address function Massimo Bighelli <info@arcasistemi.it> - 2013-04-26 18:07 +0200
    Re: IP Address function Martin <spam@spam.spam> - 2013-04-30 15:15 +0100
  Re: IP Address function dlzc <dlzc1@cox.net> - 2013-04-26 12:12 -0700
  Re: IP Address function "Willie Moore" <williem@wmconsulting.com> - 2013-04-26 14:23 -0500
  Re: IP Address function "Jamal" <jamal@examples.net> - 2013-04-29 11:09 -0400

csiph-web