Web Hosting Info

Search:

featured partner

The IP to Country Database

  Forum Topics : Wish List / IP-to-Country Protocol
Submitted by vinay on Sat, 06/21/2003 - 02:44.
I think the IP-to-Country web service should be a protocol for the following reasons:

1) HTTP is quite an overhead considering the information exchange that needs to take place between the client and server. For example consider this telnet session from my machine:

------ BEGIN TELNET SESSION ------
[vinay@vinay vinay]$ telnet ip-to-country.com 80
Trying 203.199.107.154...
Connected to ip-to-country.com (203.199.107.154).
Escape character is '^]'.
GET /country/name/202.54.1.18 HTTP/1.1
Host: ip-to-country.com

HTTP/1.0 200 OK
Date: Sat, 21 Jun 2003 06:46:21 GMT
Server: Apache/1.3.22 (Unix) (Red-Hat/Linux) Midgard/1.4.1/SG mod_jk mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.4pl1
X-Powered-By: PHP/4.0.4pl1
Content-Type: text/html
Connection: close

India
Connection closed by foreign host.
------ END TELNET SESSION ------

The relevant information provided actually is just a few bytes i.e., 202.54.1.18
and response required is just the country name i.e., "India" in this case.

So basically all the HTTP headers are not required.


2) Parsing HTTP headers in other languages like C is quite a pain.
(I understand that in PHP it is just one line of code! )

3) A protocol would be more specific and focussed to the application rather than working on HTTP nitty gritties like URL encoding which increases complexities on the client side.


This is my basic idea of how the IP-to-Country Protocol would be like (its almost like the WHOIS protocol)

S = server
C = client

telnet ip-to-country.com <port_number>
S: ip-to-country VER 1.0 (version information so that the client understands what commands does the server recognize)
C: 202.54.1.18
S: India
C: quit
S: Cya


next version of the server can have multiple parameters.... like so

C: 202.54.1.18, 202.54.1.30, 203.199.107.154
S: India, India, India


Does any one dig this idea?
Comment viewing options:
Select your preferred way to display the comments and click 'Save settings' to submit your changes.
No!
Posted by Nick2588 on Mon, 06/23/2003 - 16:24.
ACK! No way! NO! The IP-To-Country database using the HTTP protocol means that many programming languages can easily access it, without writing a whole set of functions to convert the information returned from the database into usable information. People using PHP, C, Visual Basic, Java, whatever can access the database quickly and easily because of Directi's smart use of HTTP and their decision NOT to use their own proprietary protocol!

About the HTTP headers: Just shorten them. We don't need such as long Server: header. IP-to-Country people can fix this by editing the Apache config file (see the ServerTokens directive in httpd.conf). Also, the X-Powered-By: header could be completely removed.


    "Parsing HTTP headers in other languages like C is quite a pain. (I understand that in PHP it is just one line of code! )"
Uhm, why do you need to parse the HTTP headers!? You yourself said they contain no useful information. To tell if a line is an HTTP header, look for the presence of a colon (:) in the line (using grep, or InStr, or strpos, or whatever the related function is in your language). If the line contains a colon, ignore it.
I agree that this system shou
Posted by taspas on Tue, 06/24/2003 - 19:17.
I agree that this system should also be available in a lighter format. I was thinking about using simple UDP queries, so you wouldn't even have the overhead of forming a TCP connection. The whole query for one country would be over in just two small packets instead of something closer to 10 for the http version.

There might be at least one catch here; you probably need to have some sort of per query unique token so you don't end up mixing multiple simultaneous queries with wrong answers due to the nature of UDP. But it doesn't need to be complicated, for example the query could be "id:some_unique_token code2:192.168.4.32" and the answer might be "id:same_unique_token code2:jp". If there's no id field in the query, then the response would not contain one either, so a program that doesn't need to be sure doesn't need to go through the hassle of extra parsing and maintaining id-mappings.


And another thing came to mind: how about using DNS for distributing the information? DNS provides failover, load balancing and caching features naturally. The system could be something like is in use today in spam blacklists that are distributed using DNS.

For example a PTR query for 6.4.2.10.code3.country.directi.com (ip address 10.2.4.6) could return something like "deu.code3.country.directi.com." for germany etc.

Also what is needed is support for IPv6 addresses. The current web version does not seem return anything useful for IPv6-address queries. And queries for private address space addresses seem to return funny country codes..
The idea for a non-http proto
Posted by achost on Sat, 07/05/2003 - 03:38.
The idea for a non-http protocol actually is very interesting, so I took a few hours tonight and built a basic tcp server in php for the job. It simply asks for the IP, queries it against a mysql DB with the ip-to-country data in it, and then returns c2code, c3code, and country in the form c2code:c3code:country which just needs to be parsed into separate variables and then you can do whatever with it. If you want to have a peek at the source, the code, and instructions are located here: http://www.jrcsnet.ca/iptocountry/.
 
Neat!
Posted by sandeep on Tue, 07/22/2003 - 15:10.
Me like! :)
Related post: ip2c package
Lorix
Posted by Jomas56 on Sat, 04/28/2007 - 00:13.
There are some: fingering housewife video He take fingering housewife video. big boobs blonde I want big boobs blonde everyday. asian teen cum Asian teen cum is interesting. anal creampie movies Watch anal creampie movies on your TV-set. slut wife training I think, slut wife training is compulsory. fetish pump This is fetish pump, isn't it? big breasted japanese I go to big breasted japanese girl. anal close ups Her anal close ups. cum shemale shot Hard cum shemale shot? it is. big breasted hairy He has met big breasted hairy woman. asian teen bondage Asian teen bondage is web-page. anal brutal Anal brutal - it is hard. fetish pornstar Him fetish pornstar is not available. asian teen cock His long asian teen cock is thick. kinky mature sluts There are few kinky mature sluts in the town. cum internal shot This was cum internal shot! gay boys movies He take part in the gay boys movies. lesbian black white She said:" lesbian black white." mature bisexual sex Mature bisexual sex is attractive. teens nipple ring Teens nipple ring is good :). teens naked in There are plenty of teens naked in the room. mature asian slut His wife is mature asian slut. lesbians in public This lesbians in public sites. gay glory holes Gay glory holes is not myth. cum laude magna This is cum laude magna. mature asian poser Hi was mature asian poser. teens fuck teacher That teens fuck teacher. Ha-ha. lesbian big boob His nick was "lesbian big boob". gay blowjob movie Alex try download gay blowjob movie. asian cum shot It is natural asian cum shot. In bucks we trust.