private function findOpenPort() {
		$sock = socket_create(AF_INET, SOCK_STREAM, 0);

		// Bind the socket to an address/port
		if( !socket_bind($sock, $this->getHost(), 0) ) {
			throw new Exceptions\RuntimeException('Could not bind to address');
		}

		socket_getsockname($sock, $checkAddress, $checkPort);
		socket_close($sock);

		if( $checkPort > 0 ) {
			return $checkPort;
		}

		throw new Exceptions\RuntimeException('Failed to find open port');
	}
private function findOpenPort() {
		$sock = socket_create(AF_INET, SOCK_STREAM, 0);

		// Bind the socket to an address/port
		if( !socket_bind($sock, $this->getHost(), 0) ) {
			throw new Exceptions\RuntimeException('Could not bind to address');
		}

		socket_getsockname($sock, $checkAddress, $checkPort);
		socket_close($sock);

		if( $checkPort > 0 ) {
			return $checkPort;
		}

		throw new Exceptions\RuntimeException('Failed to find open port');
	}
private function findOpenPort ( ) { $ sock = socket_create ( AF_INET , SOCK_STREAM , 0 ) ; // Bind the socket to an address/port if ( ! socket_bind ( $ sock , $ this -> getHost ( ) , 0 ) ) { throw new Exceptions \ RuntimeException ( 'Could not bind to address' ) ; } socket_getsockname ( $ sock , $ checkAddress , $ checkPort ) ; socket_close ( $ sock ) ; if ( $ checkPort > 0 ) { return $ checkPort ; } throw new Exceptions \ RuntimeException ( 'Failed to find open port' ) ; }
Let the OS find an open port for you.

@return int
Let the OS find an open port for you .