Results 1 to 8 of 8

Thread: QTcpSocket: ConnectingState

  1. #1
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QTcpSocket: ConnectingState

    Hi,
    I've created a simple server-client application and I've a problem abouot the QTcpSocket.
    The client request a new connection to the server, this one accept it, but the status of the socket created remain always in ConnectingState.
    Is there somebody that know why?

    Attached there is my code.

    N.B. I'm using Qt 4.3.5.
    Attached Files Attached Files
    Last edited by fruzzo; 29th July 2009 at 09:42.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTcpSocket: ConnectingState

    because the server can accept multiple connections?

  3. #3
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QTcpSocket: ConnectingState

    Quote Originally Posted by caduel View Post
    because the server can accept multiple connections?
    What do you means?
    The maximum number of pending accepted connections are the default one so...30.

    Another thing...the instance of TcpRadioHandler is done (both server and client) in the run() of a QThread.

  4. #4
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpSocket: ConnectingState

    .......................................

  5. #5
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QTcpSocket: ConnectingState

    Any idea about the problem?

  6. #6
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTcpSocket: ConnectingState

    Quote Originally Posted by fruzzo View Post
    What do you means?
    The maximum number of pending accepted connections are the default one so...30.
    Can you forget the state for time being and transfer the data over socket meanwhile. So we can see, the problem.

  7. #7
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTcpSocket: ConnectingState

    Sorry-----------------------------------

  8. #8
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QTcpSocket: ConnectingState

    Solved...just after the connectToHost I insert an waitForConnected:

    socket->connectToHost(hostIp, hostPort);
    if (socket->waitForConnected(1000))
    qDebug("Connected!");

    No I've another kind of problem...After client-server are connected when I sent a message (msg#1) from client to server, the server must response with another message (msg#2) just after the first one but I've a strange behaviour. The msg#1 is received by server with a little bit latency after sended by client (some milliseconds) instead the msg#2 is received by client after 2-3 seconds. why?

Similar Threads

  1. Challenging QTcpSocket reliability problem
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 13th January 2009, 10:38
  2. array of pointers to QtcpSocket
    By gQt in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th June 2008, 09:15
  3. QTcpServer & QTcpSocket questions...
    By jxmot in forum Qt Programming
    Replies: 2
    Last Post: 24th April 2008, 21:38
  4. QTcpSocket and libssh2 ...
    By sandros in forum Qt Programming
    Replies: 6
    Last Post: 21st November 2007, 22:34
  5. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 20:44

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.