I have this simple code:
_____________________________
void ClientThread :: run()
{
QTcpSocket tcpSocket;
if(!tcpSocket.setSocketDescriptor(socketDescriptor ))
{
std::cout << "Error setting the socket descriptor\n";
return;
}
std::cout << "clientThread is running\n";
quint16 clientPort;
clientPort = tcpSocket.peerPort();
std::cout << "the client's port is: " << clientPort << "\n";
QByteArray block("hello there\n");
tcpSocket.write(block);
}
___________________________________________-
The server is suppose to say "hello there" to the client.

1. The client is a telnet that succesfully connects to the server, but it never receives the message from the server. Why ?

2. the connection is closed by the server. I want the connection to be alive all the time. How ?