Results 1 to 2 of 2

Thread: Problem on connection establishment with QTcpSocket

  1. #1
    Join Date
    Nov 2011
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Problem on connection establishment with QTcpSocket

    I 'm trying to make up a socket connection performing the following steps:

    TcpClient::TcpClient() : m_socket(this) {
    bool ok;
    ok = QObject::connect(&m_socket, SIGNAL(error(QAbstractSocket::SocketError)),
    this, SLOT(displayError(QAbstractSocket::SocketError)));
    Q_ASSERT(ok);
    ok = QObject::connect(&m_socket, SIGNAL(connected()),
    this, SLOT(handleConnection()));
    Q_ASSERT(ok);
    }


    where the m_socket is defined as

    QTcpSocket m_socket;


    and this is not doing any problem on a Unix based plaform.

    If I try to execute the same application in a Windows platform, it crashes and i don't know why.
    No compile error was find, but when I launch the app, it freezes when i define the object used to send TCP messages:

    ncp::TcpClient clnt;

    Does anyone have any ideas why it crashes?
    Thank you in advice.

    Mirko.

  2. #2
    Join Date
    Nov 2011
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem on connection establishment with QTcpSocket

    In particular the problem resides in

    ok = QObject::connect(&m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError)));

    i think on errror function (and the same on the connected 2 lines after).

    Is possible that there is an error addressing this function?
    Any ideas to solve it?

    Mirko.

Similar Threads

  1. Replies: 0
    Last Post: 11th November 2011, 19:18
  2. QTcpSocket connection problem
    By valdemar593 in forum Qt Programming
    Replies: 17
    Last Post: 27th May 2011, 18:13
  3. Problem with connection
    By Adonitos in forum Qt Programming
    Replies: 4
    Last Post: 8th April 2011, 11:56
  4. Replies: 1
    Last Post: 15th November 2010, 11:36
  5. QTcpsocket - connection problem
    By vishesh in forum Qt Programming
    Replies: 1
    Last Post: 16th October 2007, 17:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.