How to get your own IP in Blitz?

BlitzMax Forums/BlitzMax Programming/How to get your own IP in Blitz?

True I should check the code archive more often but I need it to work in BlitzMax. I have no problems at all whatsoever with this in Blitz3D.

I converted that codearchive example to BMax - Do you get your IP from it? Is it just my machine?

( btw it requires you to install the BNet module )

' Get the IP on this machine
ips=CountHostIPs("")
If Not ips End '; No countee, no IP

IP=HostIP(1)
DotIP$=DottedIP(ip)

Global octetList:TList = CreateList()

Type Toctet
	Field value
	Method New()
		octetList.Addlast(Self)
	EndMethod
End Type

Global octets[3]

Print "Source Integer IP:"+IP
Print "Sourse Padded  IP:"+DotIP$
Print
Print "=---Converting---="
Print

If ParseIP(DotIP)
	count=3
	
	For Local O:Toctet = EachIn octetList
		octets[count] = o.value
		Print "Octet "+count+" ="+octets(count)
		count=count-1
	Next
EndIf

byte4=octets[3] Shl 24
byte3=octets[2] Shl 16
byte2=octets[1] Shl 8
byte1=octets[0]
ip2=byte4 Or byte3 Or byte2 Or byte1

Print "Converted:" + DotIP +" back to :"+ ip2

WaitKey()
End

Function parseip(ip$)
	If Len(ip$)>6
		ip$=ip$
		lastperiod=1
		For t=1 To 4							'; four octets
			period=Instr(ip,".",lastperiod)		'; Separtated by 3 periods
			If period=0
				If t=4							'; If its the last octet Then we dont expect To find a period
					period=Len(ip)+1			'; stay within bounds
				Else	
					Return False
				EndIf
			EndIf
		
			If period>lastperiod
				octet = Int( Mid$(ip,lastperiod,period-lastperiod) )
				If octet>=0 And octet<=255
					o:Toctet=New Toctet
					o.value = octet
				Else
					Return False
				EndIf
			Else
				Return False
			EndIf
			lastperiod=period+1
		Next
		octet=0
		Return True
	Else
		Return False
	EndIf
End Function


This is the part which don't work for me?!
ips=CountHostIPs("")
If Not ips End '; No countee, no IP
There is ends.. A bug in BNet?