diff --git a/backend/app/main.py b/backend/app/main.py index 91e2e2d0..d409580a 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -41,20 +41,20 @@ def getPort(): port = 50011 - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - foundOpenPort = False - while not foundOpenPort: - try: - s.bind(("127.0.0.1", port)) - _log.info(f"found open port: {port}") - foundOpenPort = True - except socket.error as e: - if e.errno == errno.EADDRINUSE: - _log.info(f"Port {port} is already in use") - else: - _log.error(f"Error while trying to connect to port {port}: {e}") - port += 1 - s.close() + # s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + # foundOpenPort = False + # while not foundOpenPort: + # try: + # s.bind(("127.0.0.1", port)) + # _log.info(f"found open port: {port}") + # foundOpenPort = True + # except socket.error as e: + # if e.errno == errno.EADDRINUSE: + # _log.info(f"Port {port} is already in use") + # else: + # _log.error(f"Error while trying to connect to port {port}: {e}") + # port += 1 + # s.close() return port if __name__ == '__main__': diff --git a/electron/ui/src/AppContext.js b/electron/ui/src/AppContext.js index 1294b039..f7c15608 100644 --- a/electron/ui/src/AppContext.js +++ b/electron/ui/src/AppContext.js @@ -8,38 +8,38 @@ export const useApp = () => { export const AppProvider = ({ children }) => { const [ port, setPort ] = useState(50011); - const [ foundPort, setFoundPort ] = useState(false) + const [ foundPort, setFoundPort ] = useState(true) - useEffect(() => { - /* - search for backend port - */ - fetch('http://localhost:'+port+'/get_project_name', { - method: 'GET', - mode: 'cors', - }) - .then(response => { - if (response.status === 200) { - response.json() - .then((data)=>{ - if (data === "pareto") { - // console.log("found pareto on port "+ port) - setFoundPort(true) - } - else { - setPort(port + 1) - } - }).catch((err)=>{ - setPort(port + 1) - }) - } - else { - setPort(port + 1) - } - }).catch((err) => { - setPort(port + 1) - }) - }, [port]); + // useEffect(() => { + // /* + // search for backend port + // */ + // fetch('http://localhost:'+port+'/get_project_name', { + // method: 'GET', + // mode: 'cors', + // }) + // .then(response => { + // if (response.status === 200) { + // response.json() + // .then((data)=>{ + // if (data === "pareto") { + // // console.log("found pareto on port "+ port) + // setFoundPort(true) + // } + // else { + // setPort(port + 1) + // } + // }).catch((err)=>{ + // setPort(port + 1) + // }) + // } + // else { + // setPort(port + 1) + // } + // }).catch((err) => { + // setPort(port + 1) + // }) + // }, [port]); const value = {