Hi again,
I am writing a socket programme and i send data to my server.
bool TcpClient::connectToServer()
{
if(!isConnectionOpen())
{
tcpSocket->connectToHost(_serverAddress,_serverPort);
}
return true;
}
{
if(!isConnectionOpen())
{
connectToServer();
}
tcpSocket->write((sendMsg+"\n").toAscii().data());
return "OK";
}
bool TcpClient::connectToServer()
{
if(!isConnectionOpen())
{
tcpSocket->connectToHost(_serverAddress,_serverPort);
}
return true;
}
QString TcpClient::sendMessageToServer(QString sendMsg)
{
if(!isConnectionOpen())
{
connectToServer();
}
tcpSocket->write((sendMsg+"\n").toAscii().data());
return "OK";
}
To copy to clipboard, switch view to plain text mode
This function is return OK. I want to return response from server. For example;
My send data : Hello
Server Response : blablabla
this function's response : blablabla
How can I return response from server. I use TCP-IP protocol.
Bookmarks