[SOLVED] Cannot connect to localhost from QTcpSocket to QTcpServer

  • Hi everyone.

    I have strange issue. I wrote network applications. one server and one client. it worked fine until today. but today I have a problem. server started and QTcpServer::listen method returns true(so it listening to host localhost:1234). but from my client and telnet I can't connect to localhost:1234.

    Why? any ideas?

  • OK. Solution was so simple. I am on windows and there is file named hosts on the path C:\Windows\System32\drivers\etc. just edit this file and add this line: localhost

    Sometimes some application during the installation edits this file and replaces localhost
    with localhost

    so you need to fix it manually.