Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24

Thread: Strange QTcpSocket behavior (debugged with Ethereal)

  1. #21
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Strange QTcpSocket behavior (debugged with Ethereal)

    Quote Originally Posted by Thoosle View Post
    But, before the server responds(about 300usec after first attempt) the client has apparently concluded that the connection didn't work and so it increments it's listening port number and sends another SYN packet to again try to connect.
    TCP doesn't work that way. Timeouts are much longer and SYN should be repeated on the same port. Using a different port suggests the previous try was abandoned..

    And after the server tries to respond to the first connection attempt the client sends RST to cancel that first attempt, since it's no longer listening there!!
    This is a regular behaviour. You could try to use iptables (or simmilar) to stop the client machine from sending RST (-j DROP instead of -j REJECT) and see what happens then.

    Shortly after that the server catches up and replies with SYN/ACK to the second attempt. From that point communication proceeds normally.
    So why doesn't it happen with the second attempt?

    I think this is exactly what was happening to the original posters on this thread . For what ever reason, the server I'm connecting with is not responding to the first connection attempt fast enough!!
    There is nothing like "fast enough" with TCP. The initial TCP timeout can often be changed by tweaking system settings, but it's surely bigger than 0.1s. Otherwise you could never connect to lagging or distant servers (connections through a satellite link would also not be possible).

    The question at this point is.....is the server not responding fast enough or is the connection attempt unreasonable in it's expectations regarding timing? Anyone have thoughts on this? Is the server simply slow or do I need to configure something relative to the socket or Linux or whatever?
    I suggest you try with different servers. If you were connecting to IIS, it has a well known "feature" of cheating the statistics and you might be experiencing that. But since you're connecting to some java software, it's either the software problem or the operating system. Does the same happen (on the same target box) when using Qt servers from networking examples?

  2. #22
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Strange QTcpSocket behavior (debugged with Ethereal)

    I agree if the first connection attempt was given enough time.....I should have said fast enough for whatever it is that's causing the first attempt to throw in the towel and try again!! The thing is, these timing issues RE the first connection attempt failing then trying again, don't always happen. The initial exchange works fine sometimes but fails most of the time. And, I'm talking about the minimal code app I wrote for testing. If I comment out the statement with waitForConnected(1000) then the initial packet exchange seems rock solid, acting properly each time I try it.

    Here's another clue, I configuired to run the java app on the Linux machine and the minimal test code to point to 127.0.0.1......wireshark shows rock solid connections even with the waitForConnected(1000) line in place...... suggesting this is possibly something to do with the XP machine....

    Also, on the Xp machine I run Norton Internet Security....I turned it all off including the windows firewall(which was never enabled anyway) and got the failing exchange attempt test results as usual.

    I haven't tried a test of Qt client/server example code from the Linux machine to the windows machine, I'm not setup to build Qt apps on windows at the moment but it's about the only test left!!

  3. #23
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Strange QTcpSocket behavior (debugged with Ethereal)

    At least it clearly indicates the problem is with the host machine.

  4. #24
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Strange QTcpSocket behavior (debugged with Ethereal)

    yes sir! I think it does. Witold, thanks for all the good comments and insight.....also, putting together this forum.....a really valuable resource for beginners like myself..

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.