Feb 6, 2003 #1 lexx Technical User Nov 23, 2000 25 US I have been hashing this out for several sleepless nights.. can some one help. I want VB6 to convert the dotted quad IP to a decimal.. I know VB has no function for this....
I have been hashing this out for several sleepless nights.. can some one help. I want VB6 to convert the dotted quad IP to a decimal.. I know VB has no function for this....
Feb 6, 2003 #2 CassandraR Programmer Aug 10, 2001 346 CA Hi Lexx: Not sure what you are looking for in the decimal. Can you give an example of a conversion that you are looking for? For example, given 123.456.789.012, what decimal do you want to convert to? Cassie Upvote 0 Downvote
Hi Lexx: Not sure what you are looking for in the decimal. Can you give an example of a conversion that you are looking for? For example, given 123.456.789.012, what decimal do you want to convert to? Cassie
Feb 6, 2003 Thread starter #3 lexx Technical User Nov 23, 2000 25 US I ping a host URL and it returns the IP. but when I try to get the decimal conversion from the IP it is in reverse order.. Your IP: 123.456.789.012 After the decimal conversion it will be: 012.789.456.123 when converted back from the decimal form to the IP. I tried the VB: StrReverse(Address) Refresh function, to reverse the string but it fails to return the decimal equivalent in proper order for the web browser. Upvote 0 Downvote
I ping a host URL and it returns the IP. but when I try to get the decimal conversion from the IP it is in reverse order.. Your IP: 123.456.789.012 After the decimal conversion it will be: 012.789.456.123 when converted back from the decimal form to the IP. I tried the VB: StrReverse(Address) Refresh function, to reverse the string but it fails to return the decimal equivalent in proper order for the web browser.
Feb 6, 2003 Thread starter #4 lexx Technical User Nov 23, 2000 25 US I know why now.. inet_addr breaks dotted quad to a string and returns the byte return in lowest value from right to left instead of left to right. 230.79.58.64 = R to L yahoo.com IP backwards 197166914 = decimal " " " I have to use the function ntohl( network to host long ) in order to return the IP to byte order left to right. 64.58.79.230 = L to R yahoo.com IP correct. 1077563366 = decimal " " " Trying to use strReverse(address) to reverse the string 230.79.58.64 to 64.58.79.230 failed. This is how it works for intel machines. Upvote 0 Downvote
I know why now.. inet_addr breaks dotted quad to a string and returns the byte return in lowest value from right to left instead of left to right. 230.79.58.64 = R to L yahoo.com IP backwards 197166914 = decimal " " " I have to use the function ntohl( network to host long ) in order to return the IP to byte order left to right. 64.58.79.230 = L to R yahoo.com IP correct. 1077563366 = decimal " " " Trying to use strReverse(address) to reverse the string 230.79.58.64 to 64.58.79.230 failed. This is how it works for intel machines.