-
Oct 21st, 2019, 09:51 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Fastest way to convert long IP address from network to dotted string
Greetings,
I have to do this a lot. Does anyone have any ideas on how to do it faster than the way I am doing it below.
Any ideas welcome.
thanks
Private Type myBytes
b1 As Byte
b2 As Byte
B3 As Byte
B4 As Byte
End Type
Private Type myLong
Val As Long
End Type
Public Function tcpAgentLong2IP(ByRef ip As Long, ByRef ipAddress As String) As Boolean
10 On Error GoTo errorHandler
Dim l As myLong
Dim b As myBytes
Dim theIp As String
20 tcpAgentLong2IP = True
30 l.Val = ip
40 LSet b = l
50 ipAddress = (CStr(b.b1) & "." & CStr(b.b2) & "." & CStr(b.B3) & "." & CStr(b.B4))
70 Exit Function
errorHandler:
80 errorDisplay Err.description, "tcpAgentLong2Ip", Erl
90 Resume endofitall
endofitall:
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|