zoukankan      html  css  js  c++  java
  • java 网络编程基础

     InetAddress ip = InetAddress.getByName("www.baidu.com");
    
            System.out.println("是否可达: "+ip.isReachable(2000));
    
            System.out.println(ip.getHostAddress());
    
            InetAddress local = InetAddress.getByAddress(new byte[]{127,0,0,1});
    
            System.out.println("本机是否可达:" + local.isReachable(5000));
    
            //获取IP的全限定域名
            System.out.println(local.getCanonicalHostName());
    
            //当涉及到普通字符串与非西欧字符串的相关转换时,可以用URLEncoder和URLDecoder
    
            String ChineseUrl = URLEncoder.encode("青岛","GBK");
    
            System.out.println(ChineseUrl);
    
            System.out.println(URLDecoder.decode(ChineseUrl,"GBK"));
  • 相关阅读:
    Scala-函数
    Scala--循环
    scala(一)
    拦截器filter
    Ajax实现分页二
    并发1
    泛型
    协议protocol
    结构体structure
    类的继承
  • 原文地址:https://www.cnblogs.com/vector11248/p/8297785.html
Copyright © 2011-2022 走看看