zoukankan      html  css  js  c++  java
  • Intenet 地址

    java.net.InetAddress类是java对Ip地址(包括ipv4和ipv6)的高层表示,大多数其他网络类都要用到这个类,包括Socket, ServerSocket, URL, DatagramSocket, DatagramPacket等

    InetAddress address = InetAddress.getByName("www.baidu.com"); //生产InetAddress的工厂方法,设置InetAdress类中的一个私有字段,并建立与本地DNS服务器的一个链接,来查找数组和名字地址 , 不检查DNS

    InetAddress[] address = InetAddress.getAllByName("www.baidu.com");//得到所有地址

    InetAddress address = InetAddress.getLocalHost(); //得到主机地址,即运行这段代码的主机地址 ,不可信代码总是返回主机名127.0.0.1

    Ipublic static InetAddress.getByAddress(byte[] addr) throws UnknownHostException //用一个IP地址创建一个InetAddress对象

    Ipublic static InetAddress.getByAddress(String hostname,byte[] addr) throws UnknownHostException //用一个主机名和一个IP地址创建一个InetAddress对象

    byte[] address = {107,23,(byte)216,(byte)196}  //必须把两个大数组转换成字节
    InetAddress lessWrong= InetAddress.getByAddress(address)  ;

    SecurityManager s = new SecurityManager();
    s.checkConnect("223.210.232.29", 80);如果调用线程不允许打开与指定的主机和端口号的套接字连接,则抛出一个 SecurityException

  • 相关阅读:
    DOM对象的一些常用方法
    body-parser的使用
    CSS中box-sizing: border-box
    ES6 数组方法 --- map() filter() find()的用法
    JavaScript --- 预编译
    Vue过滤器filter
    Lock wait timeout exceeded; try restarting transaction
    lead函数
    Mysql 数据词典
    OOD
  • 原文地址:https://www.cnblogs.com/jiangfeilong/p/10508051.html
Copyright © 2011-2022 走看看