In VB6, I used to be able to create an IP address string from a long value by using the following statement/API call:
Then I would read the string from the pointer returned to get the IP address in dotted quad format.Code:lpStr = inet_ntoa(lngAddress)
I am trying to port this to VB.NET using the following code:
Usually this works, sometimes not. For example, if lngAddres = -156482353 (msn.com), I get the following exception: "Specified argument was out of the range of valid values."Code:Dim oIP As New IPAddress(lngAddress) strData = oIP.ToString
Anyone have any idea what I may be doing wrong? The old API way returned the proper value = 207.68.172.246.
Brad




Reply With Quote