Forum Topics : Wish List / IP-to-Country Protocol
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?
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?
