⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scanhandlerimpl.java

📁 一个JAVA实现的端口查询工具
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package portscan.service.impl;import java.io.IOException;import java.net.Socket;import java.util.logging.Level;import java.util.logging.Logger;import portscan.service.ScanHandler;/** * * @author 小虫 */public class ScanHandlerImpl implements ScanHandler {    private String ipAddress;    public ScanHandlerImpl(String ipAddress) {        this.ipAddress = ipAddress;    }    public boolean isPortOpen(int port) {        Socket socket = null;        try {            socket = new Socket(ipAddress, port);            return true;        } catch (IOException ex) {//            Logger.getLogger(ScanHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);        } finally {            try {                if(socket!=null){                    socket.close();                }                            } catch (IOException ex) {                Logger.getLogger(ScanHandlerImpl.class.getName()).log(Level.SEVERE, null, ex);            }        }        return false;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -