In my app, I create a ServerSocket
, and wait for connections:
while(isRunning) {
try {
socket = serverSocket.accept();
I then try to get the remote IP of the resulting socket:
socket.getInetAddress().getHostAddress();
However, this seems to only return an IPv6 address.
For my purposes, I believe I need an IPv4. Is there some way to get an IPv4 address from a socket?