Class of IP bug with IP integer carrier ?

Archives Forums/Blitz3D Bug Reports/Class of IP bug with IP integer carrier ?

Etica(Posted 2007) [#1]
Hi, I'm coding a client/server game application.
I'm testing the software on 4 PC dual processor INTEL genuine XP service pack2 with directx9.0c, blitz3D updated at 1.99 version (weird in the IDE dialog still appears 1.98)

I have a problem when setting my LAN on a 192.x.x.x class of IPs.

Apparently the internal Blitz IP integer number returned using this class of IP on the machines, breaks the numbers or something because ANY connection (machines ping each other no problem) can be done between the machines.

Changing the Class to an 10.x.x.x class, or whatever below number 100 for the first row in the machines, everything work just fine.

I possibly discovered the bug:

The ip integer for a eg: 192.168.1.x IP is: -1062731417
a very large negative number !
But for eg: 90.168.1.x is just: 168427523

Is the problem of NO CONNECTION MADE coming from this "bug" ?

Thank you for the attention
I do an example to clarify better.


Etica(Posted 2007) [#2]
I post some code to explain the problem.

If you are under a LAN with IP mask like: 192.168.x.x
Try this code and see the integer number is a negative one.

Machines are pinging each other (the clients to the server and the server to the clients) no problem.

I launch the server program hosting on 192.168.1.101

The clients just cannot connect!!

If I change all the LAN ip mask to 99.168.1.101 everything work just fine, and FAST!

PLEASE! HELP!

; First call CountHostIPs (blank infers the local machine) 
n = CountHostIPs("") 
; n now contains the total number of known host machines. 

; Obtain the internal id for the IP address 
ip = HostIP(1) 

; Convert it to human readable IP address 
ipaddress$ = DottedIP$(ip) 

Print "Dotted IP Test" 
Print "==============" 
Print "" 
Print "Internal Host IP ID:" + ip 
Print "Dotted IP Address:" + ipaddress$ 
Print "" 
Print "Press any key to continue" 

WaitKey() 
 

;-=-=-=Convert an IP from x.x.x.x to integer format.
Function ConvertIp%(IP$)
	dot1 = Instr(IP$,"."):dot2 = Instr(IP$,".",dot1+1):dot3 = Instr(IP$,".",dot2+1)
	Octet1% = Mid$(IP$,1,dot1-1)
	Octet2% = Mid$(IP$,dot1+1,dot2-1)
	Octet3% = Mid$(IP$,dot2+1,dot3-1)
	Octet4% = Mid$(IP$,dot3+1)
	Return (((((Octet1 Shl 8) Or Octet2) Shl 8) Or Octet3) Shl 8) Or Octet4
End Function