Use Asp.net to obtain local weather forecasts based on IP addresses Visit www.163.com. The homepage contains the local weather forecast. We can guess that the weather forecast here should be based on the visitor's IP address to determine the local weather conditions. I asked some friends and confirmed this. The project
Java socket based on UDP/IP protocol applicationServer side: 1, create Datagramsocket, specify port number2. Create Datagrampacket3, receive the data sent by the client4. Read dataClient:1. Define send message: The IP port number of the server to send the content2. Create a datagrampacket that contains the information that will be sent3. Create Datagramsocket4. S
forgets the protocol cluster.
2.socket Communication Model
3. Decomposition and encapsulation of data transmitted based on TCP/IP protocol
4. Client/server Mode
In TCP/IP network applications, the main mode of interaction between two processes of communication is client/server mode * (Client/server), that is, customers like service their request, the serve
both the PHP include and the National Home Information database files are in the same directory as the PHP file itself. If the example is different from your installation, you need to change the path as needed.
The sample code is quite straightforward, and after introducing the GeoIP PHP Library, the first step is to open the GeoIP database file using the Geoip_open () function. This function receives two parameters: a database file path and a database type.
We then use the handle returned by t
example assumes that both the PHP include and the National Home Information database files are in the same directory as the PHP file itself. If the example is different from your installation, you need to change the path as needed.
The sample code is quite straightforward, and after introducing the GeoIP PHP Library, the first step is to open the GeoIP database file using the Geoip_open () function. This function receives two parameters: a database file path and a database type.
We then use the
PHP snippet (send SMS, find address based on IP, display source code of Web page, check server for HTTPS, display faceboo** number, detect main color of image, get memory usage information)
1. Send SMS Call Textmagic API. Include the Textmagic PHP librequire (' textmagic-sms-api-php/textmagicapi.php ');//Set the username and password inform Ation$username = ' MyUserName '; $password = ' mypassword ';//Cre
').')';
// Close database handler// Www.knowsky.com
Geoip_close ();
// Print compulsory license notice
Echo'
-- This product has des GeoIP data created by MaxMind, available from http://maxmind.com /--';
?>
The code in List A shows the basic methods for the application module (geoip. inc) to visit the GeoIP free *** database (GeoIP. dat. The example assumes that PHP include and the information database files of the national family are in the same directory as the PHP file itself. If the example
sample is different from your installation, you need to change the path as needed.
The example code is quite clear, and after the introduction of the GeoIP PHP Library, the first step is to use the Geoip_open () function to open the GeoIP database file. This function receives two parameters: the database file path and the database type.
We then use the handle returned by the call Geoip_open () to obtain the two-letter country code and the intuitive country name
First, Node.js implementation code
Copy Code code as follows:
var http = require (' http ');
var util = require (' util ');
/**
* Obtain address information based on IP access
*/
var getipinfo = function (IP, CB) {
var sina_server = ' http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=jsonip= ';
var url = sina_server +
file itself. If the sample is different from your installation, you need to change the path as needed.
The example code is quite clear, and after the introduction of the GeoIP PHP Library, the first step is to use the Geoip_open () function to open the GeoIP database file. This function receives two parameters: the database file path and the database type.
We then use the handle returned by the call Geoip_open () to obtain the two-letter country code and the intuitive country name
The major websites are provided according to the IP to obtain the user's geographical location information, here to Sina's interface as an exampleThe interface address is: http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=jsip=218.18.171.146Code:1 #regionGet locations based on IP2 ///Get IP Attribution3 /// 4 /// IP5
I have previously written about HTTP-based communication at the network transmission layer. Now the project needs to implement the TCP/IP communication protocol. I searched through the network. Someone has already written a public class library asyncsocket, the following describes how to use asyncsocket.
Asyncsocket official documentation: http://code.google.com/p/cocoaasyncsocket/
The usage is as follows:
C # obtain provinces and cities based on IP addresses,
/// /// Obtain the province and city based on the IP address/// Public void GetAddressByIp (){String ip = "115.193.217.249 ";String PostUrl = "http://int.dpool.sina.com.cn/iplookup/iplookup.php?
broadcast;
Determine the data transmission direction, generally set to full duplex mode;
Enable interrupt;
Enable receiving interruption;
Determine the interrupt PIN number of cs8900a Based on the usage of the hardware line;
Receive and send enable.
It must be noted that due to the frequent TCP/IP communicationArmThe interrupted mode occupies too many resources.Query MethodTo ensure ba
This document is based on FreeBSD and bind platforms. Win users should be avoided. If there is no FreeBSD basic, do not. Linux or other Unix users can serve as reference documents.
Configuration steps:1. Preface2. Software List3. Install BIND 94. Configure BIND 95. Test BIND 96. Add an NS address7. Add a domain name8. Test Domain Name
I. PrefaceThis article assumes that you have some experience in FreeBSD operations, understand the daily FreeBSD oper
A simple requirement, a simple script.Starting with an IP, generate the correct IP address by the specified number.#!/usr/bin/env python## encoding:utf-8import osdef getip (IP, count): count = Int (count) ip2 = Int (Ip.split ('. ') [-2]) ip1 = Int (Ip.split ('. ') [-1]) Ip_before = '%s.%s '% (Ip.split ('. ') [0], Ip.split ('. ') [1])
[ASP. NET advanced] returns the corresponding location information based on the IP address, asp. netip
In fact, it is to use the functional interface of Baidu's IP library and then process it as follows:
Preparations:
1. Register as a developer, create an application to obtain the accesskey of Baidu API call, Baidu Development Center address: http://developer.ba
Get provinces and cities according to IPpublic void Getaddressbyip (){string ip = "115.193.217.249";String posturl = "http://int.dpool.sina.com.cn/iplookup/iplookup.php?ip=" + IP;string res = Getdatabypost (posturl);//The data returned by this request is: res=1\t115.193.210.0\t115.194.201.255\t china \ t zhejiang \ t Hangzhou T-Telecomstring[] arr = getareainfoli
Java method for determining countries based on IP addresses
The website provides the IP address corresponding to the country database in CSV format:
Http://software77.net/cgi-bin/ip-country/geo-ip.pl
The website also provides links to scripts for processing the data in various mainstream languages:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.