PDA

View Full Version : Multiple connections with QTcpSockets



DrDonut
11th September 2009, 11:42
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.

yogeshgokul
11th September 2009, 11:58
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:

socket.waitForReadyRead(msec);
This will blocks until data is available for reading.