summaryrefslogtreecommitdiff
path: root/NET/worlds/network/DNSLookup.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-13 02:05:49 -0800
committerFuwn <[email protected]>2026-02-13 02:05:49 -0800
commit9817c9b1647faaa1ffe4af5a7620a8602651f438 (patch)
treeff22dd2e017565aadc146062f0c7064e74035df2 /NET/worlds/network/DNSLookup.java
parentfix: Decompilation artifact repairs for Java 11 compilation (diff)
downloadworldsplayer-9817c9b1647faaa1ffe4af5a7620a8602651f438.tar.xz
worldsplayer-9817c9b1647faaa1ffe4af5a7620a8602651f438.zip
feat: Reimplement core I/O and system information native methods with pure Java
- FastDataInput: DataInputStream wrapper replacing native binary I/O - DNSLookup: InetAddress.getAllByName() replacing native gethostbyname() - Restorer: Array.newInstance() replacing native makeArray() - SystemInfo: Runtime/File APIs for disk, memory, CPU, platform info - StatMemNode: Runtime APIs for memory status reporting
Diffstat (limited to 'NET/worlds/network/DNSLookup.java')
-rw-r--r--NET/worlds/network/DNSLookup.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/NET/worlds/network/DNSLookup.java b/NET/worlds/network/DNSLookup.java
index 878c63d..4775a2f 100644
--- a/NET/worlds/network/DNSLookup.java
+++ b/NET/worlds/network/DNSLookup.java
@@ -128,5 +128,20 @@ public class DNSLookup implements Runnable {
}
}
- private static native String[] gethostbyname(String var0);
+ private static String[] gethostbyname(String var0) {
+ try {
+ java.net.InetAddress[] addresses = java.net.InetAddress.getAllByName(var0);
+ String[] result = new String[addresses.length];
+
+ for (int i = 0; i < addresses.length; i++) {
+ result[i] = addresses[i].getHostAddress();
+ }
+
+ return result;
+ } catch (UnknownHostException e) {
+ System.out.println("DNS lookup failed for: " + var0);
+
+ return new String[0];
+ }
+ }
}