I wanna test my program with VMWare. So I’ve run the program in a VMWare. Using ipconfig command on that machine gives me some IP like 192.168.XXX.XXX. It has a server socket listening on some port, on this IP. When someone needs to speak with it, it connect to this 192.168.xxx.xxx IP fine (using Socket s = new Socket(IP, port)).
But when inside the program I call socket.getInetAdress() which should return the 192.168.x.x IP, it returns 0.0.0.0 instead, and the simulation fails.
What can I do?
Thanx in advance 🙂
This is a Java issue rather than a VMWare issue. I’m assuming that you’re trying to get your machine’s IP rather than just the ip that the server is bound to. In that case, see this question for some proposed solutions: java InetAddress.getLocalHost(); returns 127.0.0.1 … how to get REAL IP?