How to get the Country according to a certain IP? [duplicate]

There are two approaches: using an Internet service and using some kind of local list (perhaps wrapped in a library). What you want will depend on what you are building. For services: http://www.hostip.info/use.html (as mentioned by Mark) http://www.team-cymru.org/Services/ip-to-asn.html For lists: http://www.maxmind.com/app/geoip_country (as mentioned by Orion) You could roll your own by downloading the lists from … Read more

Maximum length of the textual representation of an IPv6 address?

45 characters. You might expect an address to be 0000:0000:0000:0000:0000:0000:0000:0000 8 * 4 + 7 = 39 8 groups of 4 digits with 7 : between them. But if you have an IPv4-mapped IPv6 address, the last two groups can be written in base 10 separated by ., eg. [::ffff:192.168.100.228]. Written out fully: 0000:0000:0000:0000:0000:ffff:192.168.100.228 (6 … Read more