interfacelistentry.java

来自「DSr project for the java applications」· Java 代码 · 共 45 行

JAVA
45
字号
package dsr;import java.net.*;//this class implements an entry for an interface listclass InterfaceListEntry {  public String ifIndex;              //index number  public String name;                 //name of the interface  //RouteTableEntry routeEntry;  public InetAddress ipAddress;       //ip address of this interface  public DatagramSocket localSocket;  //socket that might be associated with this interface  //default constructor  InterfaceListEntry() {}  //constructor  InterfaceListEntry(InetAddress ip, String n, String index                     /*RouteTableEntry tempEntry*/, int port) {    ipAddress = ip;    name=new String(n);    ifIndex= new String(index);    //routeEntry = new RouteTableEntry(tempEntry);    try {      localSocket = new DatagramSocket(port, ip);    } catch (SocketException e) {}  }  //copy constructor  InterfaceListEntry(InterfaceListEntry rhs) {    this.ifIndex = rhs.ifIndex;    this.name = rhs.name;    this.ipAddress = rhs.ipAddress;    this.localSocket = rhs.localSocket;  }  //toString function to convert the entry in the displayable sting format  public String toString() {    String value = "\nIP Address is " + ipAddress.toString() +                   "\nName of the interface is " + name +                   "\nInterface index is " + ifIndex; /* +                   "\nsocket info is " + localSocket.getLocalPort();*/    return value;  }}

⌨️ 快捷键说明

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