I am trying to develop a system where there are different nodes that are run on different system or on different ports on the same system.
Now all the nodes create
firstly import the class
import java.net.InetAddress;
in class
InetAddress iAddress = InetAddress.getLocalHost(); String currentIp = iAddress.getHostAddress(); System.out.println("Current IP address : " +currentIp); //gives only host address