How to get IP Address on Clien of LAN....? Help me!!!!!!

Hi,!

I want get IP Address on Clien of LAN, but I don't know what to use for get it. I need your help, please. Thanks all...!

 

 



Answer this question

How to get IP Address on Clien of LAN....? Help me!!!!!!

  • Greg Brewer

    How about :-

    o = CREATEOBJECT("MSWinsock.Winsock")
    o.LocalIP

    HTH,

    Robbo.


  • wingbyte

    If you need to get IP address of any client i LAN, you can use something like this :

    DECLARE INTEGER WSACleanup IN ws2_32

    DECLARE STRING inet_ntoa IN ws2_32 INTEGER in_addr

    DECLARE INTEGER gethostbyname IN ws2_32 STRING host

    DECLARE INTEGER WSAStartup IN ws2_32 INTEGER wVerRq, STRING lpWSAData

    DECLARE RtlMoveMemory IN kernel32 As CopyMemory;

    STRING @Dest, INTEGER Src, INTEGER nLength

    IF WSAStartup(0x202, Repli(Chr(0),512)) = 0

    GetIP('server') && computer name

    = WSACleanup()

    ENDIF

    FUNCTION GetIP(cServer)

    #DEFINE HOSTENT_SIZE 16

    LOCAL nStruct, nSize, cBuffer, nAddr, cIP

    nStruct = gethostbyname(cServer)

    IF nStruct = 0

    RETURN '0.0.0.0'

    ENDIF

    cBuffer = Repli(Chr(0), HOSTENT_SIZE)

    cIP = Repli(Chr(0), 4)

    = CopyMemory(@cBuffer, nStruct, HOSTENT_SIZE)

    = CopyMemory(@cIP, buf2dword(SUBS(cBuffer,13,4)),4)

    = CopyMemory(@cIP, buf2dword(cIP),4)

    RETURN inet_ntoa(buf2dword(cIP))

    FUNCTION buf2dword(lcBuffer)

    RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;

    Bitlshift(Asc(SUBS(lcBuffer, 2,1)),8) +;

    Bitlshift(Asc(SUBS(lcBuffer, 3,1)),16) +;

    Bitlshift(Asc(SUBS(lcBuffer, 4,1)),24)



  • Paulo Faustino

    Verry thanks!
  • How to get IP Address on Clien of LAN....? Help me!!!!!!