This method can obtain the Domain Name of the remote host or the local name. The getHostName method is defined as follows:
Public String getHostName ()The following are three ways to create an InetAddress object. In these three ways, the values
This method can get the domain name of the remote host, and can also get the native name . The GetHostName method is defined as follows:Public String gethostname ()Here are three ways to create a InetAddress object, and in these three ways, the
Both getsockname and gethostname can obtain IP addresses, but there are other IP addresses:
Getsockname: gets the IP address related to a specific socket.
Gethostname: obtains all IP addresses of the local machine.
Let's take a look at their
Use "gethostname ();" Get the computer name, first look at the source:In Code::Blocks 16.01, set up project build Options...,debug > Linker settings > Link libraries: > Add, Add libwsock32.a, which is located in the installation directory codeblocks\
# Include # Include // hostent, gethostbyname gethostbyaddr# Include // memcpy# Include # Include // inet_ntop# Include # Include # Include Int main (void){Unsigned long d;Struct in_addr ADDR;Char * IP = "192.168.1.11 ";D = inet_addr (IP );Memcpy
Today, hostname settings are not very concerned, but once a Linux host encounters a hostname setting problem, it may also cause some incredible network problems and service process problems.Hostname check,Uname-nHostname-A |-S |-d |-FHostname
1. gethostname ()
The gethostname () method can obtain the Domain Name of the remote host or the local name. The gethostname method is defined as follows:
public String getHostName()
The following are three ways to create an inetaddress object. In
1. gethostname () method
Definition: Public String gethostname ()
Gethostname returns different values based on the method used to create an inetaddress object.
1. UseGetlocalhost ()Inetaddress object created by the method
GethostnameThe local
The getCanonicalHostName method is the same as the getHostName method to obtain the Domain Name of the remote host. But they have a difference. The host name obtained by getCanonicalHostName is the host alias obtained by getHostName.
Using DLL files in vc.netCreate a new Vc.net project Demotestdll based on the dialog box, the following diagram (run result chart):
In order for Demotestdll to be able to invoke the TestDLL.dll program, the former is required to "see" the DLL
1. In the simplest client/server program, a client is a process and only one connection is initiated, you only need to modify it to allow a client to initiate multiple connections and then use only one connection to send data.
First, let's get to
We often need to use IP whitelist, IP blacklist. Netty itself has helped me implement a set of validation mechanisms that provide the Ipfilterrulehandler class public class Ipfilterrulehandler extends Ipfilteringhandlerimpl Public abstract class
The general way to learn C language is to first learn C and then C ++. It is best to have the basis of assembly language and microcomputer principles, followed by Visual C ++. This method takes a lot of time and endurance for learners. In school
I don't know, how do you define your own project's environment, I say the environment is online (master), test (Beta), development (Dev), native (local) this, like we do by setting up the machine's host
// 环境选择if (gethostname() === 'TBJ-Test') {
How to view functions in python is similar to the man function in linux.
[Root @ iZ94gh8l046Z python] # pythonPython 2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2Type help, copyright, credits or license
I don't know how everyone defines the running environment of their own projects. I am talking about the environment: Online (master), testing (beta), Development (dev), local (local) this is like setting the host of the machine. {code ...} I don't
IPaddress, ipendpoint, and iphostentry are located in the namespace system. NET and provide IP address operations.
IPaddress is an IP address class encapsulated by. net.
Common Methods:
1. IPaddress. parse ()
Public static IPaddress
Host information
Just as we can determine the user information, the program can also determine the information of the computer on which it runs. The uname command provides this information. Uname also serves as a system call to provide the same
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.