Skip to content

Commit

Permalink
Add fallback for local socket address
Browse files Browse the repository at this point in the history
Same problem and same solution as brunodev85#48

To be more clear: getLocalHost might fail (as it does on my device, where I have a nethunter chroot which sets kali as hostname and getLocalHost can't resolve it)
getLoopbackAddress would be a more elegant solution if it would get the loopback ipv4, but it might return an ipv6 (again, in my case it does) which doesn't actually connect to the server
  • Loading branch information
ricnava00 authored Jan 26, 2024
1 parent e6dd7a5 commit 6f552dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/com/winlator/winhandler/WinHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ public void start() {
try {
localhost = InetAddress.getLocalHost();
}
catch (UnknownHostException e) {}
catch (UnknownHostException e) {
try {
localhost = InetAddress.getByName("127.0.0.1");
} catch (UnknownHostException ex) {}
}

running = true;
startSendThread();
Expand Down

0 comments on commit 6f552dd

Please sign in to comment.