QAbstractSocket::UnknownSocketError provides errorString of "UnknownError"

1.7k views Asked by At

I am unable to get any further information regarding this error:

QAbstractSocket::UnknownSocketError

The QT QAbstractSocket::SocketError provides only a basic explaination that some error has occured

An unidentified error occurred.

enum value = -1

Calling QTcpSocket::errorString() provides this:

"Unknown error"

There is one question regarding this here on SO but provides no real solution to solving the issue (and what was suggested I have done)

I have absoltely no idea how to further progress with this error

p.s. I looked for some stacktrace/backtrace option, didn't find anything - if there is, please leave a comment

UPDATE

Code:

//Server

//...
if (tcpServer.listen(QHostAddress().AnyIPv4, 5000)) {
    qDebug() << "tcpserver started on port : 5000";
}
else{
    qDebug() << "tcpserver failed to start";
}
//...

//Client

//...
tcp_con = new QTcpSocket(new QObject());
tcp_con->connectToHost("127.0.0.1", 5000);

switch (tcp_con->error()) {
    //...
    case QAbstractSocket::UnknownSocketError:
    qDebug() << "tcp error UnknownSocketError closed : " << tcp_con->errorString();
    return;
    //...
}

Client debug output:

tcp error UnknownSocketError closed :  "Unknown error"

Any advice?

0

There are 0 answers