on button click do this
sock.connectToHost(ipaddr, port);
QObject::connect(&sock,
SIGNAL(readyRead
()),
this,
SLOT(read
()));
sock.connectToHost(ipaddr, port);
QObject::connect(&sock, SIGNAL(readyRead()), this, SLOT(read()));
To copy to clipboard, switch view to plain text mode
In read()
while(sock.canReadLine())
{
line.setLength(4096);
line = sock.readLine(); // read the line of text
line=line.trimmed();
qDebug()<<"read"<<line;
}
while(sock.canReadLine())
{
QString line;
line.setLength(4096);
line = sock.readLine(); // read the line of text
line=line.trimmed();
qDebug()<<"read"<<line;
}
To copy to clipboard, switch view to plain text mode
Hope this helps
On exit click
close socket
disconnect object
Bookmarks