Quote:
Originally posted by Joetella Here are my routines for IP conversion,
Note that I'm using Byte arrays and not Strings: Code:
Private Function IPtoByte(ByVal sTemp As String) As Byte()
On Error GoTo HandleError
Dim lPos As Long
Dim sBucket() As String
Dim bTemp() As Byte
ReDim bTemp(0 To 3)
sBucket = Split(sTemp, ".")
For lPos = 0 To 3
bTemp(lPos) = CByte(Val(sBucket(lPos)))
Next lPos
IPtoByte = bTemp
Exit Function
HandleError:
Call LogError("IPtoByte")
End Function
Private Function ByteToIP(ByRef bTemp() As Byte, ByVal lTemp As Long) As String
On Error GoTo HandleError
ByteToIP = CStr(bTemp(lTemp)) _
& "." & CStr(bTemp(lTemp + 1)) _
& "." & CStr(bTemp(lTemp + 2)) _
& "." & CStr(bTemp(lTemp + 3))
Exit Function
HandleError:
Call LogError("ByteToIP")
End Function |
Thanks Joetella! You've given me some clues and, after doing a bit more research of my own, I think I may have found the answer I was looking for. Seems to me that the sample code I have is wrong.... which is partly why I was confused in the first place.
Once again, thanks!
- SJF