to country code
ip2cc.c is an ANSI C command line* application that receives an IPv4 number and returns the ISO 3166* two letter lower-case code that identifies the country assigned to that IP.
This C code was designed to be extremely fast in making that decision since this application is typically used in a Web site's home page where speed is important for first impressions. In order to achieve that a second ANSI C application was developed, mk-ip4db.c, that takes a standard file in a CSV* format similar to:
and tests, validates, optimizes and compacts it into a 2Mb binary database highly optimized for searches. With this database, ip2cc can always find any IP's country by looking only at 1.5kb (three 512 byte sectors) of that file. The search cycle is a C function with only 35 lines, including comments. During the search, the application always takes up less than 20kb of memory which is extremely important in a Web server environment with multiple running processes.
This application can thus achieve extremely fast results while using very few processing, memory and disk resources.
Licensed according to one of the options on the left:
The applications are written in strict ANSI C and should therefore run practically on any computer platform, including Windows and Unix/Linux.
The purchase of this software makes you the owner of a ZIP file that will be e-mailed to you, containing:
- The source-code or the executable binaries, depending on the purchased licensing (see to the left).
You will also be eligible for free e-mail technical support and free upgrades, should you find any flaws that are fixed.
These applications have been developed under Windows XP and Vista, compiled with GCC and were recompiled, installed and are in production in LAMP platforms* since 2003. ip2cc is used by this site for the initial auto-detection of country and probable visitor preferred language, as well as pre-selection of country in the order process.
The applications are also pre-installed and accessible to hosting clients. They have no known bugs.
Even though these applications don't need to run with special permissions, during their development special care was taken with the strict validation of buffers in order to prevent any buffer overflow attacks.