Вопрос

I have a problem with the QTcpSocket library.

I created two programs that communicate with the same client using the same socket connection. Unfortunately, doing in this way, if the programs write at the same time, the client reads only one string by the socket (generally the first one).

So i need to know if a particular function exists (or a way) to know if the socket is or not busy in order to delay the second string to send.

Thanks in advance.

Это было полезно?

Решение

You can't have 2 clients using the same socket. The server should work with a QTcpServer and everytime you receive a new connection (from a client) you create a new QTcpSocket (Obviously, everything server-side for now). And the client works with a QTcpSocket to connect to the server.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top