Web Hosting Info

Search:

featured partner

The IP to Country Database

  Forum Topics : Development / DLL for easy use of IPs and ip-to-country list
Submitted by active on Sun, 07/25/2004 - 02:38.
I have developed a DLL which contains some basic functions that are used to get IPs in different formats and get different info from it, the library also uses this great ip-to-country list to enable you lookup of the country info for selected IP.
I have seen several requests in forum(s) for formulas how to calculate longint from IP and vice versa etc. I needed it too, so I did this for my own use, but since I got this list for free, why shouldn't I give something back?

Some basic functions are here:
ValidateIP <-- check if IP is in valid format
IP2Longint <-- convert IP to it's longint representative (i.e. for searching the list)
Longint2IP <-- convert from longint to IP
IPWithBits2Hosts <-- convert from IP/bits (127.0.0.0/24) format to number of hosts (256) in subnet
IPWithBits2Range <-- convert from IP/bits format to number of hosts and range of IPs in subnet (i.e. 127.0.0.5/24 --> 256 hosts --> 127.0.0.0 - 127.0.0.255)
IPBits2Netmask <-- convert the bits to netmask i.e. 24 -> 255.255.255.0
Netmask2IPBits <-- convert the netmask to bits i.e. 255.255.255.0 -> 24
GetIPCountry <-- returns country codes (2 and 3 char), country name and true/false if country info was found

The implementation is made default in Delphi and Kylix, if there will be enough requests for a C++ .h file I will make it but I think that if this library should show usefull that someone else will do it faster than me.

DLL is available free of charge for use and can be obtained from me directly, if there is a place on this site where I could post it I would do it.

Uros
Comment viewing options:
Select your preferred way to display the comments and click 'Save settings' to submit your changes.
Nice work!!
Posted by DeMo on Fri, 11/05/2004 - 23:42.
Hey, nice work!!
I'm interested in using your DLL to simplify the process of searching for the country name.

Can it search the CSV file or just databases?
Can I use it from inside a Visual Basic application?

Thank you!
 
Here's the DLL to download
Posted by active on Sun, 11/14/2004 - 14:08.
Hi!

Here's the link where you can download the DLL and it's implementation to Delphi.
It can be used in any windows application that supports linking DLLs, I have tested it in CBuilder.

Currently the DLL works only with the CSV file provided by webhosting.info.

http://www.powercom.si/free/IPTools.zip

Re, Uros