Standardizing for PKGBUILD
This commit is contained in:
35
Java/PortTest.java
Normal file
35
Java/PortTest.java
Normal file
@@ -0,0 +1,35 @@
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.net.Socket;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class PortTest {
|
||||
|
||||
|
||||
private String host;
|
||||
private int port;
|
||||
|
||||
public PortTest(String host, int port) {
|
||||
this.host=host;
|
||||
this.port=port;
|
||||
}
|
||||
|
||||
public void Test() {
|
||||
try {
|
||||
Socket socket = new Socket(this.host,this.port);
|
||||
PrintWriter out = new PrintWriter(socket.getOutputStream(),true);
|
||||
out.println("");
|
||||
System.out.println("OK");
|
||||
} catch (Exception e) { System.out.println(e.getMessage()); }
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
PortTest t = new PortTest(args[0],Integer.parseInt(args[1]));
|
||||
t.Test();
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user