Home > Net >  C # for CentOS system IP address (know CentOS computer name)
C # for CentOS system IP address (know CentOS computer name)

Time:10-05

Background: the server is currently a CentOS server
Implementation: need to know the computer name of CentOS get the IP address of the CentOS
Internet for Windows to see more, the visual is invalid in the CentOS

CodePudding user response:

Didn't try this, but could theoretically, basic protocol layer is the same

Can use ping, in either an ARP agreement, based on TCP/IP protocol family everyone a abide by,

CodePudding user response:

Checked the name discovery protocol is IBM published standard TCP protocol NetBIOS

This is supported by the

You can use nbtstat command line to see if a CentOS alone can get IP (nbstat command line inside actually use the NetBIOS protocol)

As long as it can get, we can get with code, it is a common protocol

CodePudding user response:

You this is on the LAN for centos server's IP address, please

Run a system command is the most simple, then redirect the output
Such as.net lookup centos_name
To return to xx. Xx. Xx. Xx

CodePudding user response:

reference stherix reply: 3/f
you that is on the LAN for centos server's IP address, please

Run a system command is the most simple, then redirect the output
Such as.net lookup centos_name
To return to xx. Xx. Xx. Xx

Application scenario is a local area network (LAN)

CodePudding user response:

Var list=Dns address. GetHostAddresses (computer name);
Var ipV4 address=list. FirstOrDefault (x=& gt; X.A ddressFamily==System.Net.Sockets.AddressFamily.InterNetwork);
  •  Tags:  
  • C #
  • Related