`
louisling
  • 浏览: 143938 次
  • 性别: Icon_minigender_1
  • 来自: ZhuHai
社区版块
存档分类
最新评论

Get machine name from IP

    博客分类:
  • Java
阅读更多
public static void main(String[] args) throws Exception {
    String addr = getMachineNameFromIP("192.168.1.159");
    System.out.println(addr);
}

static String getMachineNameFromIP(String ipAddr) {
    try {
        InetAddress i = InetAddress.getByName(ipAddr);
        return i.getHostName();
    } catch (UnknownHostException e) {
        e.printStackTrace();
        return "NULL";
    }
}
分享到:
评论

相关推荐

    c# 获取IP地址方法汇总

    虽然`Environment.MachineName`不直接返回IP地址,但可以结合`Dns`类一起使用来获取: ```csharp public static string GetMachineIPAddress() { return Dns.GetHostEntry(Environment.MachineName)....

    VB获取局域网计算机名称和IP.rar_sittingi2k_获取局域网_计算机IP获取

    Console.WriteLine("Computer Name: " & Environment.MachineName) Next ``` 4. **多线程和异步操作**:如果局域网中有大量计算机,为了提高效率,VB可以使用多线程或异步编程技术来并发处理多个请求。例如,使用...

    获取多个物理地址,ip、cpu地址、计算机名等

    最后,获取计算机名可以直接使用`Environment`类的`MachineName`属性: ```csharp using System; public static string GetComputerName() { return Environment.MachineName; } ``` 以上代码分别实现了获取物理...

    win 3.11 for workgroup tcpip支持

    causes the name to be stored in the name cache when the machine is first initialized, so the name gets resolved without the driver having to open LMHOSTS at run time. IP Routing ---------- Multiple ...

    8-07-14_MegaCLI for linux_windows

    LSIP200233163 (DFCT) improve the manner and customer experience of transitioning from MR mode to iMR LSIP200233100 (DFCT) MR5.4 MegaCli - does not recognize the adapter LSIP200233107 (DFCT) Error ...

    C# 邮件服务器

    then you get the debug or release version from application folder. Installation run MailServerLauncher.exe to install as windows service or just run as desktop application with or without tray icon. ...

    Obtain the hardware information of the PC Using C#.rar

    6. 计算机名:同样使用`Environment`类的`MachineName`属性获取: ```csharp string computerName = Environment.MachineName; // 输出计算机名 ``` 7. 系统类型:查询`Win32_OperatingSystem`类获取操作系统的...

    C#根据ip获取远程电脑的网卡信息,默认状态下获取本机的网卡信息

    string targetMachine = "远程计算机IP或域名"; ManagementScope scope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", targetMachine)); scope.Connect(); ``` 3. 执行WMI查询,获取远程计算机...

    获取 系统 信息 c#版本

    例如,`Environment.OSVersion`属性可以获取操作系统的版本信息,`Environment.MachineName`则能获取计算机的名称。 接下来,我们可以利用`ManagementObjectSearcher`和`ManagementObjectCollection`类来获取更详细...

    Oracle应用常见傻瓜问题 1000问

    FROM table_name WHERE memo_column IS NULL; ``` #### 22. 如何用BBB表的资料去更新AAA表的资料(有关联的字段) 可以使用`UPDATE`语句结合`JOIN`来实现跨表更新。例如: ```sql UPDATE aaa a SET a.column_name = ...

    ORACLE应用常见傻瓜问题1000问

    例如,`SELECT text FROM user_source WHERE name = 'TRIGGER_NAME' AND type = 'TRIGGER';` ### 计算表占用空间的大小 利用`DBMS_SPACE`包中的`GET_TABLESPACE_FREE_SPACE`函数,结合`DBA_TABLES`和`DBA_SEGMENTS...

    oracle傻瓜问题1000问

    SELECT name FROM v$database; ``` ### 19. 如何在Oracle服务器上通过SQLPLUS查看本机IP地址? 在SQL*Plus中,可以使用PL/SQL中的内置函数来获取服务器的IP地址: ``` SELECT host_name || ' (' || inet_address...

    Windows 2008 R2常用的25个PowerShell命令

    15. **远程安装MSI包:** 使用`$wmi = Get-WmiObject -ComputerName TARGETMACHINE -Query 'SELECT * FROM Win32_Product WHERE Name="name_of_product"'`; `$wmi.Install(\\MACHINEWHEREMSIRESIDES\path\package....

    VB编程资源大全(英文源码 网络)

    Run on someone else machine to retrieve system info,dial up passwords, bookmarked urls etc etc<END><br>42 , icqp.zip Send ICQ messages from VB<END><br>43 , DekMate2.0.zip All new DeskMate2.0 ...

    MySQL的安装配置教程

    `,查询`SELECT * FROM table_name;`。 5. 权限管理:为用户分配权限,如`GRANT ALL PRIVILEGES ON db_name.* TO 'user'@'localhost' IDENTIFIED BY 'password';`。 五、学习资源 压缩包中的"MySQL的安装配置教程....

    计算机网络第六版答案

    23. The five layers in the Internet protocol stack are – from top to bottom – the application layer, the transport layer, the network layer, the link layer, and the physical layer. The principal ...

    BURNINTEST--硬件检测工具

    - A network connection and the TCP/IP networking software installed for the Network Tests Pro version only: - A serial port loop back plug for the serial port test. - A parallel port loop back plug...

    linux全志R16的linux系统编译的资料_20170502_1655.7z

    rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ sudo apt-get install texinfo [sudo] password for rootroot: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 ...

    JSP总结知识点

    #### Java Virtual Machine (JVM) JVM, 即 Java 虚拟机,是 Java 程序运行的基础。无论在哪个操作系统平台上,只要安装了相应的 JVM,就可以运行 Java 程序。这意味着 Java 程序可以实现一次编写,在任何支持 JVM 的...

    Python Cookbook, 2nd Edition

    Ensuring a Name Is Defined in a Given Module Chapter 5. Searching and Sorting Introduction Recipe 5.1. Sorting a Dictionary Recipe 5.2. Sorting a List of Strings Case-Insensitively Recipe ...

Global site tag (gtag.js) - Google Analytics