some time ago to do a scheduled task, you need the server on the line to perform a scheduled task, did not find a better way to use the IP matching method, the implementation of the corresponding method. Get Server IP:
public string Getlocalip () {String ip = ""; try {//traverse the server's NIC address for (enumeration<networkinterface> en = networkinterface.getnetworkinter Faces (); En.hasmoreelements ();)
{NetworkInterface intf = en.nextelement (); for (enumeration<inetaddress> enumipaddr = intf.getinetaddresses (); enumipaddr.hasmoreelements ();)
{InetAddress inetaddress = enumipaddr.nextelement (); if (!inetaddress.isloopbackaddress () &&!inetaddress.islinklocaladdress () &&
Inetaddress.issitelocaladdress ()) {IP = inetaddress.gethostaddress (). toString (); (SocketException ex) {logger.error ("Getlocalip Get server IP
Exception: "+ ex");
Logger.info ("getlocalip get server IP =:" + IP);
return IP; }