⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 j_ineraddress.java

📁 用UDP协议实现两台电脑间的相互对话通信
💻 JAVA
字号:
//J_InerAddress.java

import java.net.InetAddress;
import java.net.UnknownHostException;

public class J_InerAddress
{
	public static void main(String args[])
	{
		String s="192.168.100.189";
		InetAddress ts=null;
		
		try
		{
			ts=InetAddress.getByName(s);
		}	
		
		catch(UnknownHostException e)
		{
			System.out.println(e);	
		}
		
		if(ts!=null)
		{
			System.out.println("The IP is "+ts.getHostAddress());
			System.out.println("The host name is "+ts.getHostName());	
		}
	}	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -