Java HTTP Port Find isPortUsed(int port)

Here you can find the source of isPortUsed(int port)

Description

is Port Used

License

Apache License

Declaration

public static boolean isPortUsed(int port) throws IOException 

Method Source Code


//package com.java2s;
/*/*from  ww  w  .jav a2s.c  o m*/
 * Copyright 2012 GBSYS.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.IOException;

import java.net.ServerSocket;

public class Main {
    public static boolean isPortUsed(int port) throws IOException {
        ServerSocket serverSocket = new ServerSocket(port);
        return true;
    }
}

Related

  1. isPortOnUse(int port)
  2. isPortOpen(int port)
  3. isPortOpen(int port, String host)
  4. isPortOpen(String host, int port)
  5. isPortUsed(final int portNumber, final String host)
  6. isPortUsing(String host, int port)
  7. isPortUsing(String host, int port)
  8. isReachable(final String hostName, int port, int timeout)
  9. isReachableByPing(String host, int port)