This was to illustrate the communication between and the separate machines which don ' t have a direct physical connection.Application data is generated and passed to Layer 3 (network layer) which wrapps up the data with the destination IP Addre Ss. Then hands to Layer 2 (link layer) which have a lookup table of IP addresses and their corresponding MAC addresses
Many projects will need to obtain the user's geographic information, but sometimes not directly through the location interface to obtain, then what to do? This paper mainly introduces the method that PHP obtains IP address and region through chianz.com, and it is a very practical technique to parse IP address and regio
::formcreate (tobject *sender){Wsadata Wsadata;if (WSAStartup (Makeword (1,1), wsadata)!=0){//initialization of Winsock callsMessageBox (NULL, "wrong WinSock Version", "Error", MB_OK);return;}Refresh1click (Sender); When the program starts, it checks the IP address}Double-click the Refresh button and add the following programvoid __fastcall Tform1::refresh1click (tobject *sender)Refreshing
If you want to find the actual geographic location of an IP address on the Earth, you can use many online GeoIp lookup services (such as geoiptool.com ). Most of these online services are supported by a free GeoIP database such as MaxMind. When using these web-based services, there are also some different methods to query the GeoIP database, especially the Linux
Name:www.baidu.comHost Address:61.135.169.125--------------------------Which Host:www.baidu.com #4Canonical Host Name:180.97.33.107Host Name:www.baidu.comHost Address:180.97.33.107
As you can see, the inetaddress class allows us to perform DNS lookups and retrieve canonical host names, host names, and IP addresses. the results above show us that multiple servers
Institutional sector
IP Address
Use people
I don't know where it's wrong, now it doesn't show information
Reply to discussion (solution)
Do you want to get the visitor's IP?
Yes, get the
/* Compiling environment: Visual C ++ */
# Include
# Include
# Pragma comment (Lib, "ws2_32.lib ")
Int doit (INT, char **)
{
Char host_name [2, 255];
// Obtain the local host name
If (gethostname (host_name, sizeof (host_name) = socket_error ){
Printf ("error % d when getting local host name./N", wsagetlasterror ());
Return 1;
}
Printf ("host name is: % s/n", host_name );
// Obtain the corresponding "host" from the host name database"
Struct hostent * Phe = gethostbyname (ho
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.