You need PHP on the server to transfer application data via SSL, wait for response data and display them on the screen.
Wrote this code in PHP:
$fp = fsockopen("ssl://localhost", 6000);
$send = "hello";
$html = fread($fp, 1000000);
And the function of receiving messages in QT4
//Create the data flow.
//If came the first part of the sent client information.
if(blockSize == 0)
cout << "data transfer from client" << endl;
//If the first part is smaller than the count of the information that determines the size of the entire message...
if(sslSocket->bytesAvailable() < (int)sizeof(qint64)) return;
//Get the size sent by the client message.
in >> blockSize;
//If the next part together less than a certain client number...
if(sslSocket->bytesAvailable() < blockSize) return;
//Reset the size parameter sent by the client message.
blockSize = 0;
//Get the string network message.
QString message; in >> message;
//Next, we create...;)
cout << message.toAscii().data() << endl;
void CConnThread::sendMessage(QString message)
QDataStream out(&block, QIODevice::WriteOnly);
out << (qint64)0;
out << message;
out << (qint64)(block.size() - sizeof(qint64));
But here's the problem — the data arrive (as evidenced by the output line of the data transfer from the client), but not displayed. The very same PHP script hangs after sending (waiting for a response, but not receiving it). What did I do wrong?