Code example for Socket

Methods: bind, close

0
	 
	 
	/** 
	 */ 
	private static boolean isBound(InetSocketAddress address) throws Exception {
		Socket socket = new Socket();
		try { 
			socket.bind(address);
			return false; 
		}catch (IOException e){
			return true; 
		} finally { 
			socket.close();
		} 
	} 
}