[Qt-interest] readyRead not working (sometimes)

Dobbs, Paul paul.dobbs at lmco.com
Wed Nov 25 16:14:56 CET 2009


I have created a C++ class which uses QUdpSocket to set up communications between two programs. I'm using the class in four different programs. Here is the code that creates the socket:

bool CSugvSocket::CreateUDPSocket(QString sendToIp, quint16 sendToPort, quint16 myPort, CTest1 *parent)
{
    m_Parent = parent;
    m_MyPort = myPort;
    m_SendToPort = sendToPort;
    m_SendToIp.setAddress(sendToIp);

    m_Socket = new QUdpSocket(this);

    connect(m_Socket, SIGNAL(readyRead()),this, SLOT(on_ReadyRead()));

    return m_Socket->bind(QHostAddress::LocalHost, m_MyPort);
}

The problem is that the socket works in two of the programs and doesn't work in the other two. In the programs that don't work, it never receives any packets. I can put a breakpoint in on_ReadyRead, but it is never reached. It is as though the connection didn't work or was severed somehow or else the readyRead signal was never being sent. I have not been able to figure out a cause. I don't even know where to start looking. Can someone help?

I am using Visual Studio 2005 with Qt 4.5.2.
Paul Dobbs
Software Engineer
Lockheed Martin Missiles and Fire Control
Phone (972) 603-1244
Cell (817) 228-4302


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091125/6b12bf34/attachment.html 


More information about the Qt-interest-old mailing list