import socket


def find_free_port(num):
    """ Finds a free port on the server.
    :param num : Number of free ports required.
    :type num: Integer
    :return port : free port no.
    :rtype: Integer
    """
    ports = []
    for _ in range(0, num):
        tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        tcp.bind(('', 0))
        addr, port = tcp.getsockname()
        tcp.close()
        ports.append(port)
    return ports