1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 10:47:28 +00:00

Whois improvement

This commit is contained in:
M66B 2022-09-04 11:40:20 +02:00
parent 5e512ecaea
commit 3645e4440e

View file

@ -25,6 +25,7 @@ import java.net.Socket;
import java.net.UnknownHostException; import java.net.UnknownHostException;
public class Whois { public class Whois {
// https://datatracker.ietf.org/doc/html/rfc812
private static final int WHOIS_PORT = 43; private static final int WHOIS_PORT = 43;
private static final int WHOIS_TIMEOUT = 15 * 1000; // milliseconds private static final int WHOIS_TIMEOUT = 15 * 1000; // milliseconds
@ -40,7 +41,7 @@ public class Whois {
Socket socket = new Socket(); Socket socket = new Socket();
socket.connect(new InetSocketAddress(host, port), WHOIS_TIMEOUT); socket.connect(new InetSocketAddress(host, port), WHOIS_TIMEOUT);
try { try {
socket.getOutputStream().write((domain + "\n").getBytes()); socket.getOutputStream().write((domain + "\r\n").getBytes());
return host + ":" + port + "\n" + Helper.readStream(socket.getInputStream()); return host + ":" + port + "\n" + Helper.readStream(socket.getInputStream());
} finally { } finally {
socket.close(); socket.close();