1

On client side, I have socket, which is connected to QTcpServer. I want to make a QtcpServer on client side, which listen on same socket. I tried this.

QTcpSocket *tcpSocket=new QTcpSocket(this); //connected socket.
QTcpServer *tcpServer=new QTcpServer(this);
tcpSocket->bind(QAbstractSocket::ReuseAddressHint);
tcpServer->setSocketDescriptor(tcpSocket->socketDescriptor());

tcpServer is listening on same socket but other client failed to connect to this tcpServer; Socket Operation time out msg is displayed. What is suggested solution.

Noor Nawaz
  • 2,175
  • 27
  • 36

1 Answers1

0

QTcpSocket inherits QIODevice so connect to signal readyRead().
Keep in mind this topic.

Community
  • 1
  • 1
Marek R
  • 32,568
  • 6
  • 55
  • 140