[Development] Qt 5.6 QTcpSocket WindowsXp32 mingw32 strange behavior of connected signal. After so many years of using Qt.

Oleg Shalnev oleg.shalnev at gmail.com
Tue Apr 26 10:54:15 CEST 2016


Hi all!
I have no idea what's the (hell) is going on.
The simplest test...


SocketTest::SocketTest()

{

  mSocket=new QTcpSocket(this);

  QObject::connect(mSocket, SIGNAL(hostFound()), this, SLOT(onHostFound()));

  QObject::connect(mSocket, SIGNAL(connected()), this, SLOT(onConnected()));

  QObject::connect(mSocket, SIGNAL(error(QAbstractSocket::SocketError)),

                   this, SLOT(onError(QAbstractSocket::SocketError)));

}


void SocketTest::start()

{

  mSocket->connectToHost(QHostAddress("1.1.1.1"), 2000);

}


void SocketTest::onHostFound()

{

  qDebug()<<"OnHostFound"<<mSocket->state();

}


void SocketTest::onConnected()

{

  qDebug()<<"OnConnected"<<mSocket->state();

}


void SocketTest::onError(QAbstractSocket::SocketError Error)

{

  qDebug()<<"OnError"<<Error;

}


And socket is connected!!!

The problem is that socket connected and signal emmited.

Only then after couple of seconds program received error "Remote host closed"


On Linux and Android all ok.


Qt 5.5 5.6, WindowsXP_32, mingw32




-- 
Oleg Shalnev  (Kalpa Knowledge Integration Initiative)
----------------------------------------------
mailto: oleg at kalpa.ru
skype:  oleg_shalnev
cell    :  +79111603306
cell    :  +79187417217
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160426/952d7154/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main.cpp
Type: text/x-c++src
Size: 192 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160426/952d7154/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sockettest.cpp
Type: text/x-c++src
Size: 788 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160426/952d7154/attachment-0001.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sockettest.h
Type: text/x-chdr
Size: 370 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160426/952d7154/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: снимок11.png
Type: image/png
Size: 9849 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160426/952d7154/attachment.png>


More information about the Development mailing list