Results 1 to 2 of 2

Thread: Multiple connections with QTcpSockets

  1. #1
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Multiple connections with QTcpSockets

    Hi all,

    For a program I am writing I use two different executables at the same time. They have to exchange data.

    For this system I use QTcpSockets, mainly the code from the chat example from QT 4.

    But it seems that over time, there are multiple connections established between the two programs. Here is what happens:

    In the beginning:
    Program A sends message.
    Program B receives message.

    But after some time:
    Program A sends message.
    Program B receives message multiple times.

    How can I prevent this?

    If you need code to see through this, please let me know what part of the code you are looking for.

    Thanks in advance!

    QT: Qt 4.4.3 open source
    OS: Windows XP home.

  2. #2
    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: Multiple connections with QTcpSockets

    Quote Originally Posted by DrDonut View Post
    But after some time:
    Program A sends message.
    Program B receives message multiple times.
    How can I prevent this?
    Do you wanna prevent this or program this.
    If program, then you can use:
    Qt Code:
    1. socket.waitForReadyRead(msec);
    To copy to clipboard, switch view to plain text mode 
    This will blocks until data is available for reading.

Similar Threads

  1. Debugging singal-slot connections
    By gnik in forum Qt-based Software
    Replies: 0
    Last Post: 11th July 2009, 19:50
  2. Multiple database connections
    By cyberboy in forum Qt Programming
    Replies: 3
    Last Post: 30th March 2008, 16:56
  3. Qt on X11 with multiple display connections?
    By grenoble in forum Qt Programming
    Replies: 1
    Last Post: 25th February 2008, 12:44
  4. Multiple connections to one method
    By davisjamesf in forum Newbie
    Replies: 4
    Last Post: 16th November 2007, 20:11
  5. Saving state of connections
    By Chuk in forum Qt Programming
    Replies: 11
    Last Post: 26th August 2007, 17:01

Tags for this Thread

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.