如何让局域网系统的IP地址使用C#.NET(在Windows服务器上运行),具有Linux操作系统
how to get ip address of LAN system having linux operating system using c#.net(running on windows server)
如果你想找到一个远程Linux系统从Windows服务器上的C#应用程序的IP地址,简单的答案是...你能吨。
If you'd like to find the IP address of a remote Linux system from a C# application on a Windows server, the short answer is... you can't.
相反,Linux系统需要告诉C#应用程序的IP地址以某种方式,或C#应用程序将需要存储在配置中的远程系统的IP地址。 (请参阅 System.Configuration
命名空间,特别是使用的app.config
)
Instead, the Linux system will need to tell the C# application its IP address in some way, or the C# application will need to have the IP address of the remote system stored in configuration. (See the System.Configuration
namespace, in particular use of app.config
.)
如果你想要做的是找到一个主机具有特定名称的IP地址,在这里看到了使用 System.Net
命名空间和一个示例应用程序 Dns.GetHostByName()
。
If what you want to do is find the IP address of a host with a particular name, see here for a sample application that uses the System.Net
namespace and Dns.GetHostByName()
.