Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.IOException;

import java.net.ServerSocket;

public class Main {
    public static boolean portIsUsing(int port) {
        ServerSocket serverSocket = null;
        try {
            serverSocket = new ServerSocket(port);
        } catch (IOException ex) {
            return true;
        }
        try {
            serverSocket.close();
        } catch (IOException ex) {
        }
        return false;
    }
}