Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Client Not connect at real external Device



  • Good Day,

    Hi I am testing my client application externally with an android device but it does not connect to the server, if I test on the same machine in debug it connects perfectly, but if I install the app on the android device it does not connect, I have tried also to do the test with the server on a fixed PC and put the client on a laptop (believing it to be a god permission problem on the manifest) but it doesn't even work this way. I want to point out that on the server I opened the firewall on the incoming port and exit 6547.

    Server:

    QString Backend::startServer()
    {
        if (!server->tcpServer->listen(QHostAddress::Any, 6547))
        {
            return "Error! The port is taken by some other service";
        }
        else
        {
            connect(server->tcpServer, &QTcpServer::newConnection, server, &ClientResearch::newConnection);
            //server->connectDb();
            return "Server started, port is openned";
        }
    }
    

    Client:

     client = new ClientResearch("192.168.1.8",6547);
    
    

    void ClientResearch::connect2host()
    {

    bool conSock = tcpSocket->state()== QTcpSocket::ConnectedState;
    
    if(! conSock )
    {
    timeoutTimer->start(3000);
    
    tcpSocket->connectToHost(host, port);
    connect(tcpSocket, &QTcpSocket::connected, this, &ClientResearch::connected);
    connect(tcpSocket, &QTcpSocket::readyRead, this, &ClientResearch::readyRead);
    }else {
        qDebug() << "socket already connect";
    

    }

    }

    
    Where am I Wrong?

  • Lifetime Qt Champion

    Hi,

    Is your device connected to the same network as your computer ?
    By firewall, do you mean the one installed on your computer ?



  • @SGaist said in Client Not connect at real external Device:

    Hi,

    Is your device connected to the same network as your computer ?
    By firewall, do you mean the one installed on your computer ?

    1 Yes my device connected to the same network, I have try at ping "192.168.1.8" but not work
    2 Firewall of windows I have disabled but not ping
    3 I'm trying to solve the problem but I haven't succeeded yet



  • Re: Client Not connect at real external Device

    If you do not have any ping at all I do suspect your router firewall settings or port blocking on your router. code wise is looking ok as long as the server is at 192.168.1.8 ...



  • I solved,the problem was in the router,the wifi was isolated


Log in to reply