晓夏

YoungCheung

Zhang Sir's technical way

java telnet校验

浏览量:691

package com;

import org.apache.commons.net.telnet.TelnetClient;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.UnknownHostException;

public class te {
    public static void main(String[] args) {
        Socket server = null;
        try {
            server = new Socket();
            SocketAddress address= new InetSocketAddress("localhost", 22);
            server.connect(address,5000);
            System.out.println("01"); //01 通
        }catch (IOException e) {
            System.out.println("02");  //02 不通
        }
    }
}


神回复

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。