package org.jeecg.modules.dnc.utils; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; /** * @author clown * * @date 2023/12/1 */ public class TelnetUtil { public static boolean telnetPort(String hostname,int port ,int timeOut) { Socket socket = new Socket(); boolean isBool = false; try { socket.connect(new InetSocketAddress(hostname,port),timeOut); isBool = socket.isConnected(); return isBool; } catch (IOException e) { try { socket.close(); } catch (IOException e1) { e1.printStackTrace(); } return isBool; } } }