gistfile1.txt import java.io.IOException;import java.net.InetSocketAddress;import java.net.Socket;import java.net.SocketAddress;import java.net.UnknownHostException;import java.util.Scanner;public class Myself {public static void main(Strin
import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import java.net.UnknownHostException; import java.util.Scanner; public class Myself { public static void main(String[] args) throws Exception{ Scanner scan = new Scanner(System.in); String ip = scan.nextLine(); scan.close(); run(ip); } public static void run(String ip)throws Exception{ try{ Socket socket = new Socket(ip,56354); SocketAddress socketAddress = new InetSocketAddress(ip,56354); socket.connect(socketAddress,100); socket.setSoTimeout(1000); socket.close(); System.out.println("ok"); }catch(UnknownHostException e){ System.out.println("no"); }catch(IOException e){ System.out.println("ok"); } } }