Here you can find the source of hasPermissionToBindPort(int port)
public static boolean hasPermissionToBindPort(int port)
//package com.java2s; //License from project: Open Source License import java.net.ServerSocket; public class Main { public static boolean hasPermissionToBindPort(int port) { ServerSocket s = null;/* w w w . j a v a 2 s .c o m*/ try { s = new ServerSocket(port); return true; } catch (Exception e) { return false; } finally { if (s != null) try { s.close(); } catch (Exception e) { } } } }