Posted: Sun Aug 18, 2002 9:45 am
Restored from previous forum. Originally posted by fred.
Another little ip enumerator I got on my PC:
Fred - AlphaSND
Another little ip enumerator I got on my PC:
Code: Select all
Structure HOSTENT
h_name.l
h_aliases.l
h_addrtype.w
h_length.w
h_addr_list.l
EndStructure
If InitNetwork()
Hostname$ = Space(255)
gethostname_(Hostname$,255)
Debug "Hostname: "+Hostname$
pHostinfo = gethostbyname_(Hostname$)
If pHostinfo = 0
Debug "Unable to resolve domain name."
Else
CopyMemory (pHostinfo, hostinfo.HOSTENT, SizeOf(HOSTENT))
If hostinfo\h_addrtype #AF_INET
Debug "A non-IP address was returned."
Else
While PeekL(hostinfo\h_addr_list+AdressNumber*4)
ipAddress = PeekL(hostinfo\h_addr_list+AdressNumber*4)
Debug StrU(PeekB(ipAddress),0)+"."+StrU(PeekB(ipAddress+1),0)+"."+StrU(PeekB(ipAddress+2),0)+"."+StrU(PeekB(ipAddress+3),0)
AdressNumber+1
Wend
EndIf
EndIf
Else
Debug "Network can't be initialized"
EndIf