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
You can use java's InetAddress class for this purpose.
InetAddress IP=InetAddress.getLocalHost();
System.out.println("IP of my system is := "+IP.getHostAddress());
Output for my system = IP of my system is := 10.100.98.228
getHostAddress() returns
Returns the IP address string in textual presentation.
OR you can also do
InetAddress IP=InetAddress.getLocalHost();
System.out.println(IP.toString());
Output = IP of my system is := RanRag-PC/10.100.98.228