Code archives/Networking/Short Dotted IP to Integer IP Converter

This code has been declared by its author to be Public Domain code.

Download source code

Short Dotted IP to Integer IP Converter by Chroma
(Posted 22 years ago)
One of the functions I wrote for my XNet Multiplayer Library.
Function DotToInt%(ip$)
	off1=Instr(ip$,".")	  :ip1=Left$(ip$,off1-1)
	off2=Instr(ip$,".",off1+1):ip2=Mid$(ip$,off1+1,off2-off1-1)
	off3=Instr(ip$,".",off2+1):ip3=Mid$(ip$,off2+1,off3-off2-1)
	off4=Instr(ip$," ",off3+1):ip4=Mid$(ip$,off3+1,off4-off3-1)
	Return ip1 Shl 24 + ip2 Shl 16 + ip3 Shl 8 + ip4
End Function

Comments

None.

Code Archives Forum